Sending email to users in vb.net -
ok im trying send email user enters email textbox. got basic idea of whats should confused should put , cmtpclient(), credentials, , from. email should go there. tryed puting in email address , credentials keep getting error " smtp server requires sercure connection or client not autherticated". here code
try dim username string username = textbox1.text dim smtpserver new smtpclient("smtp.gmail.com") dim mail new mailmessage() smtpserver.credentials = new system.net.networkcredential("what username goes here", "what password goes here") smtpserver.port = 587 mail = new mailmessage() mail.from = new mailaddress("what email should put here") mail.to.add(username) mail.subject = "qustions" mail.body = "this testing mother" smtpserver.send(mail) msgbox("mail send") catch ex exception msgbox(ex.tostring) end try end sub
use smtpserver.enablessl = true
before calling smtpserver.send(mail)
"the smtp server requires secure connection or client not authenticated"
means smtp server works on ssl enabled (encrypted) connection
Comments
Post a Comment