信箱不可用。服务器响应是:5.7.1无法中继 [英] Mailbox unavailable. The server response was: 5.7.1 unable to relay

查看:783
本文介绍了信箱不可用。服务器响应是: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(xyz@gmail.com);

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);
}

}

解决方案

在过去,中继邮件没有问题,大多数服务器接受任何目的地的邮件。但随着垃圾邮件活动的增加,设置已更改并需要进行身份验证。这意味着您必须使用SMTP服务器上的现有邮件帐户(您的客户端域邮件ID),使用身份验证方法连接到服务器,并为您的帐户发送密码。



您可能已经在使用邮件客户端(Outlook,Thunderbird等)进行身份验证。只需使用相同的参数。请注意,可以使用不同的端口。



通常使用类似

  //  这些取决于服务器的要求 
// smtp.EnableSsl = true;
// smtp.Port = 465;
smtp.UseDefaultCredentials = false ;
smtp.Credentials = new System.Net.NetworkCredential( yourusername yourpassword);


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("xyz@gmail.com");

                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);
            }
                       
        }

解决方案

In the old days relaying mail was no problem and most servers accepted mail for any destination. But with increasing spam activity the setup has been changed and requires authentication. That means that you have to use an existing mail account at the SMTP server (your client domain mail id), connect to the server using an authentication method, and send the password for your account.

You are probably already using authentication with your mail clients (Outlook, Thunderbird, etc). Just use the same parameters as there. Note that a different port may be used.

In general use something like

// These depend on the requirements of the server
//smtp.EnableSsl = true;
//smtp.Port = 465;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new System.Net.NetworkCredential("yourusername", "yourpassword");


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

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