Send Email By SMTP
Imports System.Net.Mail
Public Sub SendEmail()
Dim client As New SmtpClient()
Dim sendTo As New MailAddress("sendToAccount@gmail.com")
Dim from As MailAddress = New MailAddress("from@address.com")
Dim message As New MailMessage(from,sendTo)
message.IsBodyHtml = True
message.Subject = "Test SMTP"
message.Body = "Got it!!"' Use the same account in app.config to authenticate.
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("yourAccount@xxx.com", "YourPassword")
client.Host = "smtp.xxx.com"
client.UseDefaultCredentials = False
client.Credentials = basicAuthenticationInfo'' For smtp config
'' google use EnableSsl=True and Port = 587
client.EnableSsl = False
client.Port = 25Try
client.Send(message)
Console.WriteLine("SUCCESS")Catch ex As Exception
Console.WriteLine("SEND FAIL")
End Try
End Sub
14 ความคิดเห็น:
I will add this blog to my favorites, it is great.
watch harry potter and deathly hallows online
Wow all I can say is that you are a great writer! Where can I contact you if I want to hire you?
hi, new to the site, thanks.
Nice post!
thank for your sharing!
Hi - I am really delighted to find this. Good job!
thank you very helpful , visit myBlog : http://semicoFramework.blogspot.com
I hope this is very useful visual basic code to send an email by SMTP.. I will make use of it when it is necessary. Thanks for sharing the code and article.
This visual basic code help me a lot to send emails. I hope it will help other people also.
.net obfuscators
Hey - I am definitely delighted to find this. cool job!
Hi - I am certainly delighted to find this. cool job!
I'm so happy to read this. This is the kind of manual that needs to be given and not the random misinformation that is at the other blogs. Appreciate your sharing this greatest doc. low cost car insurance
Hey - I am definitely glad to find this. Good job!
nice tutor, i will back visit you :)
This helps me so much
Post a Comment