Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <system.net>
  2. <mailSettings>
  3. <smtp from="online_account@domain.org">
  4. <network host="pod51008.outlook.com" port="587" userName="online_account@domain.org" password="password" enableSsl="true" />
  5. </smtp>
  6. </mailSettings>
  7.  
  8. Private Sub email(ByVal att As String)
  9. Try
  10. Dim sendfrom As MailAddress = New MailAddress("online_account@domain.org", "Email with attachment")
  11.  
  12. Dim sendto As MailAddress = New MailAddress(EMP.Email)
  13. Dim attachmentFile As New Attachment(att)
  14. Dim mymessage As New MailMessage(sendfrom, sendto)
  15. With mymessage
  16. .Subject = "Email with attachment "
  17. .Body = "<br/></br/> Email message"
  18. .Attachments.Add(attachmentFile)
  19. .IsBodyHtml = True
  20. End With
  21. Dim smtpclient As New SmtpClient()
  22. smtpclient.EnableSsl = True
  23. smtpclient.Send(mymessage)
  24. Catch ex As Exception
  25. errormsg.Text = "Error Sending Email, please contact Help Desk"
  26. End Try
  27. errormsg.Text = "<div align='center'>An email has been sent to " & EMP.User_Email & ".</div><br/>"
  28. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement