使用MVCMailer尝试发送到非本地电子邮件地址时,邮件服务器需要身份验证 [英] mail server requires authentication when attempting to send to a non-local e-mail address when using MVCMailer

查看:120
本文介绍了使用MVCMailer尝试发送到非本地电子邮件地址时,邮件服务器需要身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向用户发送新闻邮件.

I want to send NewsLetter Emails to users.

我已经这样做了:

public ActionResult SendNewsLetter()
       {
           _userMailer.NewsLetter().Send();
           return View();
       }

并在userMailer类中:

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.

如果删除bbc,我可以正常发送电子邮件,因为我在web.config中提供了hello@mydomain.mobi的身份验证.

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?

有人有什么主意吗?

推荐答案

您遇到的错误消息与MVCMailer根本无关.我将与您尝试使用的SMTP服务器的系统管理员联系,并查看是否允许您使用进行身份验证的hello@mydomain.com用户发送电子邮件至userEmail的值. Web服务器使用的许多SMTP服务器通常都会对电子邮件进行限制或限制,以防止垃圾邮件.

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尝试发送到非本地电子邮件地址时,邮件服务器需要身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆