Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <system.net>
- <mailSettings>
- <smtp from="online_account@domain.org">
- <network host="pod51008.outlook.com" port="587" userName="online_account@domain.org" password="password" enableSsl="true" />
- </smtp>
- </mailSettings>
- Private Sub email(ByVal att As String)
- Try
- Dim sendfrom As MailAddress = New MailAddress("online_account@domain.org", "Email with attachment")
- Dim sendto As MailAddress = New MailAddress(EMP.Email)
- Dim attachmentFile As New Attachment(att)
- Dim mymessage As New MailMessage(sendfrom, sendto)
- With mymessage
- .Subject = "Email with attachment "
- .Body = "<br/></br/> Email message"
- .Attachments.Add(attachmentFile)
- .IsBodyHtml = True
- End With
- Dim smtpclient As New SmtpClient()
- smtpclient.EnableSsl = True
- smtpclient.Send(mymessage)
- Catch ex As Exception
- errormsg.Text = "Error Sending Email, please contact Help Desk"
- End Try
- errormsg.Text = "<div align='center'>An email has been sent to " & EMP.User_Email & ".</div><br/>"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement