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:
而在userMailer类:
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.
我将已提交的通讯邮件添加到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.
如果删除bbc,我可以正常发送电子邮件,因为我已经提供了hello@mydomain的认证。在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?
有人知道吗?
1 个解决方案
#1
1
The error message that you're encountering isn't related to MVCMailer at all. I'd contact the system administrator of the SMTP server you're attempting to use and see if you're allowed to use the hello@mydomain.com
user that you're authenticating with to send email to the value of userEmail
. A lot of SMTP servers that web servers use will often have limits or restrictions on email to prevent spamming.
您遇到的错误消息与MVCMailer没有任何关系。我将联系您试图使用的SMTP服务器的系统管理员,看看是否允许您使用您正在验证的hello@mydomain.com用户向userEmail的值发送电子邮件。许多web服务器使用的SMTP服务器通常对电子邮件有限制或限制,以防止垃圾邮件。
#1
1
The error message that you're encountering isn't related to MVCMailer at all. I'd contact the system administrator of the SMTP server you're attempting to use and see if you're allowed to use the hello@mydomain.com
user that you're authenticating with to send email to the value of userEmail
. A lot of SMTP servers that web servers use will often have limits or restrictions on email to prevent spamming.
您遇到的错误消息与MVCMailer没有任何关系。我将联系您试图使用的SMTP服务器的系统管理员,看看是否允许您使用您正在验证的hello@mydomain.com用户向userEmail的值发送电子邮件。许多web服务器使用的SMTP服务器通常对电子邮件有限制或限制,以防止垃圾邮件。