Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. Dim SmtpServer As New SmtpClient() With {
  2. .Port = 25,
  3. .Host = Email.Hostname,
  4. .Credentials = New NetworkCredential() With {
  5. .UserName = Email.UserName,
  6. .Password = Email.Password
  7. }
  8. }
  9.  
  10. Dim mail As New MailMessage() With {
  11. .From = Email.Sender,
  12. .Subject = Email.Subject,
  13. .IsBodyHtml = True,
  14. .Body = Email.WrappedHtml
  15. }
  16. If Not Email.Attachments Is Nothing Then
  17. For Each a In Email.Attachments
  18. mail.Attachments.Add(a)
  19. Next
  20. End If
  21. mail.To.Add(New MailAddress(Email.Recipient.Email, Email.Recipient.Name))
  22. Call SmtpServer.Send(mail)
  23.  
  24. SmtpServer.Dispose()
  25. mail.Dispose()
  26. SmtpServer = Nothing
  27. mail = Nothing
  28.  
  29. Using SmtpServer As New SmtpClient() With {
  30. .Port = 25,
  31. .Host = Email.Hostname,
  32. .Credentials = New NetworkCredential() With {
  33. .UserName = Email.UserName,
  34. .Password = Email.Password
  35. }
  36. }
  37.  
  38. Using mail As New MailMessage() With {
  39. .From = Email.Sender,
  40. .Subject = Email.Subject,
  41. .IsBodyHtml = True,
  42. .Body = Email.WrappedHtml
  43. }
  44. If Not Email.Attachments Is Nothing Then
  45. For Each a In Email.Attachments
  46. mail.Attachments.Add(a)
  47. Next
  48. End If
  49. mail.To.Add(New MailAddress(Email.Recipient.Email, Email.Recipient.Name))
  50. Call SmtpServer.Send(mail)
  51. End Using
  52. End Using
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement