How do I send a gmail email in vb.net? -
i want send email, gives me error.
i have code:
sub sendmail(byval title string, byval content string) dim smtpserver new smtpclient("smtp.gmail.com", 25) smtpserver.credentials = new net.networkcredential("name@gmail.com", "password") dim mail new mailmessage("name@gmail.com", "name@gmail.com", title, content) smtpserver.send(mail) end sub
i have try catch tries call method, doesnt work catch runs , thes exception: system.net.mail.smtpexception: smtp server requires secure connection or client not authenticated. server response was: 5.7.0 must issue starttls command first. b6sm3176487lae.0 - gsmtp
why error? , how fix it?
gmail uses smtp on ssl on port 465.
try doing:
dim smtpserver new smtpclient("smtp.gmail.com", 465) ... smtpserver.enablessl = true ...
Comments
Post a Comment