asp.net mvc - mail server requires authentication when attempting to send to a non-local e-mail address when using MVCMailer -
i want send newsletter emails users.
i have done this:
public actionresult sendnewsletter() { _usermailer.newsletter().send(); return view(); }
and in usermailer class:
public virtual mvcmailmessage newsletter(string useremail) { //viewbag.data = someobject; return populate(x => { x.subject = "newsletter"; x.viewname = "newsletter"; x.to.add("hello@mydomain.mobi"); x.bcc.add(useremail); }); }
i add submitted newsletter emails bcc.
but when send encounter issue:
bad sequence of commands. server response was: mail server requires authentication when attempting send non-local e-mail address. please check mail client settings or contact administrator verify domain or address defined server.
if remove bbc can send email normaly because have provided authentications hello@mydomain.mobi in web.config.
<system.net> <mailsettings> <!-- method#1: configure smtp server credentials --><smtp deliverymethod="network" from="hello@mydomain.com"> <network host="mydomain.com" port="25" username="hello@mydomain.com" password="123456" enablessl="false" /> </smtp> </mailsettings>
but im amazed why cannot send email other emails?
does have idea?
the error message you're encountering isn't related mvcmailer @ all. i'd contact system administrator of smtp server you're attempting use , see if you're allowed use hello@mydomain.com
user you're authenticating send email value of useremail
. lot of smtp servers web servers use have limits or restrictions on email prevent spamming.
Comments
Post a Comment