Skip to content

Instantly share code, notes, and snippets.

@timstephenson
Last active December 16, 2015 01:39
Show Gist options
  • Save timstephenson/5356742 to your computer and use it in GitHub Desktop.
Save timstephenson/5356742 to your computer and use it in GitHub Desktop.
Example of how we would change Watchdog to use SendGrid
' Each worker currently uses Net.Mail.SmtpClient to drop the message into the IIS outgoing mail directory.
' For SendGrid we would change the code below as follows:
If oSmtpClient Is Nothing Then
oSmtpClient = New System.Net.Mail.SmtpClient
oSmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis
End If
oSmtpClient.Send(oEmail)
' With SendGrid this would become:
If oSmtpClient Is Nothing Then
oSmtpClient = New System.Net.Mail.SmtpClient
oSmtpClient.Host = "smtp.sendgrid.net"
oSmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
oSmtpClient.UseDefaultCredentials = false
oSmtpClient.Port = 25
oSmtpClient.Credentials = new System.Net.NetworkCredential("[email protected]", "password")
End If
oSmtpClient.Send(oEmail)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment