本文介绍了信箱不可用。服务器响应是:5.7.1无法中继的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将邮件发送到客户端域,但是当我尝试向gmail或任何其他域发送邮件时,我有Windows服务邮件发送工作正常我收到错误

邮箱不可用。服务器响应是:5.7.1无法中继



即时通讯使用SMTP进行邮件发送我知道它与SMTP中继有关但我不知道如何解决它请给我解决方案



我尝试过:



 try 
{
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

SmtpClient smtp = new SmtpClient();

smtp.Host =172.16.5.2;
smtp.EnableSsl = false;
smtp.Port = 25;

msg.From =新邮件地址(客户域邮件ID);

msg.To.Add([email protected]);

msg.Subject = subject;

msg.Body = body;

msg.IsBodyHtml = true;

if(AttachmentPath!=)
{
msg.Attachments.Add(new Attachment(AttachmentPath));
}

smtp.Send(msg);

return(1);

}
catch(exception ex)
{
TraceService(ex.Message);
return(0);
}

}
解决方案

I have windows service for mail sending its working fine if i send the mail to the client domain but when i try to send mail to gmail or any other domain im getting error

Mailbox unavailable. The server response was: 5.7.1 Unable to relay


im using SMTP for mail sending i know that it is related to SMTP relay but i dont know how to resolve it please give me solution

What I have tried:

try
            {
                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

                SmtpClient smtp = new SmtpClient();

                smtp.Host = "172.16.5.2";
                smtp.EnableSsl = false;
                smtp.Port = 25;

                msg.From = new MailAddress("Client domain mail id");

                msg.To.Add("[email protected]");

                msg.Subject = subject;

                msg.Body = body;

                msg.IsBodyHtml = true;

                if (AttachmentPath != "")
                {
                    msg.Attachments.Add(new Attachment(AttachmentPath));
                }

                smtp.Send(msg);

                return (1);

            }
            catch (Exception ex)
            {
                TraceService(ex.Message);
                return (0);
            }

        }
解决方案


这篇关于信箱不可用。服务器响应是:5.7.1无法中继的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 01:54