It seems that some of the previous samples are now outdated and the System.web.mail class is now obsolete.
I will try to make is simple and easy to use:
I created this class: You can copy and paste it into a new class "Emailer"
Imports System.net.Mail
Public Class Emailer
Public Sub SendEmailMessage(ByVal sMsg As String, ByVal sTo As String, ByVal sSize As String)
'This procedure takes string array parameters for multiple recipients and files
Try
Dim MailMsg As New MailMessage(New MailAddress("Me@myplace.com"), New MailAddress(0))
MailMsg.IsBodyHtml = True
MailMsg.Subject = "Urgent - My Subject"
MailMsg.Body = sMsg.Trim() & vbCrLf
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = "10.10.10.10"
SmtpMail.Send(MailMsg)
'Message Successful
Catch ex As Exception
'Message Error
End Try
End Sub
End Class
With this you can call the class and send your email as required.
Let me know if you found this useful...
Darn I hate incomplete and old useless code samples!
Lennieboy -
Life is Good and God is Good
B-)
I will try to make is simple and easy to use:
I created this class: You can copy and paste it into a new class "Emailer"
Imports System.net.Mail
Public Class Emailer
Public Sub SendEmailMessage(ByVal sMsg As String, ByVal sTo As String, ByVal sSize As String)
'This procedure takes string array parameters for multiple recipients and files
Try
Dim MailMsg As New MailMessage(New MailAddress("Me@myplace.com"), New MailAddress(0))
MailMsg.IsBodyHtml = True
MailMsg.Subject = "Urgent - My Subject"
MailMsg.Body = sMsg.Trim() & vbCrLf
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = "10.10.10.10"
SmtpMail.Send(MailMsg)
'Message Successful
Catch ex As Exception
'Message Error
End Try
End Sub
End Class
With this you can call the class and send your email as required.
Let me know if you found this useful...
Darn I hate incomplete and old useless code samples!
Lennieboy -
Life is Good and God is Good
B-)