使用smtp客户端向多个收件人发送电子邮件时抛出异常 [英] Throwing Exception while sending Email to multiple recipients using smtp client

查看:152
本文介绍了使用smtp客户端向多个收件人发送电子邮件时抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用SmtpClient发送电子邮件的应用程序。我正在向多个收件人发送电子邮件。我有两个收件人,例如aman @ gmail.com,abc @ xyz.com。我正在尝试将电子邮件发送到此列表,但我的应用程序正在抛出以下异常:
客户端没有向该服务器提交邮件的权限。服务器响应是:4.7.1(abc@xyz.com):中继访问被拒绝。
因为这个aman@gmail.com也不能收到电子邮件。
我需要实现即使在ToList中有一个无效地址,如abc@xyz.com的功能,一个电子邮件应该成功发送到aman@gmail.com。
有人可以帮我吗?

解决方案

这个错误信息是来自您自己的电子邮件服务器还是从xyz.com?我猜测这是你自己的服务器,你需要在发送之前进行一次验证,或者使用你自己的电子邮件地址进行发送(但是后者是一个很长的镜头 - 我们不中继是指一个服务器,发件人或收件人都不能拒绝担任中间人)。也可能的是,xyz.com的邮件交换机配置错误(DNS中的MX记录指向错误的服务器,或者管理员无法配置它接受此责任 - 从技术上来说基本上是相同的)或者您的客户端最终连接到错误的地方。



(不正确的答案,但这太长时间不符合评论。)


I have an application which uses SmtpClient to send an email. I am trying to send an email to multiple recipients. I have two recipients in my to list e.g "aman@gmail.com,abc@xyz.com". and I am trying to send the email to this list but my application is throwing the exception as below: Client does not have permission to submit mail to this server. The server response was: 4.7.1 (abc@xyz.com): Relay access denied. because of this aman@gmail.com is also not able to receive the email. I need to implement the functionality that even there is an invalid address like abc@xyz.com in the ToList, an email should be sent successfully to aman@gmail.com. Can anybody please help me in this?

解决方案

Does this error message come from your own email server, or from that of xyz.com? I'm guessing it's your own server, and that you either need to aunthenticate before sending, or use your own email address for sending (but the latter is kind of a long shot -- "we do not relay" means a server which is neither the sender's or the recipient's refuses to act as a middleman). It is also possible that the mail exchanger for xyz.com is misconfigured (either the MX record in DNS points to the wrong server, or the admin failed to configure it to accept this responsibility - technically basically the same thing) or that your client somehow ends up connecting to the wrong place.

(Not a proper answer but this got too long to fit in a comment.)

这篇关于使用smtp客户端向多个收件人发送电子邮件时抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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