I want to send NewsLetter Emails to users.
I have done like 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 to bcc.
but when I send it I encounter this issue:
Bad sequence of commands. The server response was: This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.
if remove bbc I can send email normaly because I have provided authentications for 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 I cannot send email to other emails?
does somebody have any idea?