email - VB.net sendmail smtp error -
i'm using following code send email vb.net web application.
public function sendmail(byval strto string, byval strfrom string, _ byval strsubject string, byval strbody string) string try dim smtpserver new smtpclient() dim mail new mailmessage() smtpserver.credentials = new _ net.networkcredential("ns1.jasmine.arvixe.com", "<password>") smtpserver.port = 587 smtpserver.host = "mail.<mydomain>.com" mail = new mailmessage() mail.from = new mailaddress(strfrom) mail.to.add(strto) mail.subject = strsubject mail.isbodyhtml = true mail.body = strbody smtpserver.send(mail) return true catch ex exception return false end try end function
it works fine when use personal live.co.uk email address strfrom value, or made-up email address. when use different 1 (contact@mydomain.com), valid , working, following error:
"the smtp server requires secure connection or client not authenticated. server response was: smtp authentication required."
why happen?
after @ spec rfc 2554 (http://www.faqs.org/rfcs/rfc2554.html) guess receiving/relaying server employing sort of authentication scheme ensures email came wherever strfrom indicates (a valid account on server indicated after @).
item 5 of spec, "the auth parameter mail command" of particular interest.
since "auth parameter mail command" isn't used everywhere, may explain why things work email addresses , not others.
Comments
Post a Comment