asp.net - Sending email in web application -


i trying send email after click of button. exception

enter image description here

is wrong code ? have tried go gmail settings , turned on "access less secure apps" , still problem persists.

imports system.net.mail  imports system.net  partial class _default inherits system.web.ui.page`   protected sub button1_click(sender object, e system.eventargs) handles button1.click     try         dim mailmessage new mailmessage("group2@gmail.com", "ndumisosizwe@gmail.com")         mailmessage.subject = "mail body"         mailmessage.body = "this test email"         dim smtpclient new smtpclient("smtp.gmail.com", 587)         dim credentials new networkcredential("group2@gmail.com", "mypasswordhere")         smtpclient.credentials = credentials          smtpclient.enablessl = true         smtpclient.send(mailmessage)         msgbox("email sent successfully")     catch ex exception         msgbox("email failed !  " & ex.tostring)     end try end sub end class 

the exception thrown on line smtpclient.send(mailmessage)

the port using tls according page. port ssl (older version) 465.

perhaps enablessl not support tls. can try port.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -