无需凭据即可向多个域发送电子邮件 [英] send an email to multi domains without credentials

查看:115
本文介绍了无需凭据即可向多个域发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

i需要建议

i创建已发送的电子邮件类,我可以发送到我公司域内的任何邮件,但如果我需要发送电子邮件给另一个hotmail或yahoo等我得到了这个错误:

hi all,
i need advice
i create sent email class and i can send to any mails inside My company domain but if i need to send an email to another as hotmail or yahoo ,etc i got this Error :

Server Error in '/' Application.

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



请任何建议,这是我的代码:


please any Advice and this is my code :

MailMessage objEmail = new MailMessage();
objEmail.To.Add(txtTo.Text);
objEmail.CC.Add(txtcc.Text);
objEmail.Subject = "Test Email";
objEmail.Body = txtName.Text;
objEmail.Priority = MailPriority.High;
SmtpClient ss = new SmtpClient("mail.Mycompany.com");

ss.Port = 25;
ss.UseDefaultCredentials = true;

try
{
   ss.Send(objEmail);
   Response.Write("Your Email has been sent sucessfully -  Thank You");
}
catch (Exception exc)
{
   Response.Write("Send failure: " + exc.ToString());
}

推荐答案

您需要与管理您正在使用的smtp服务器的人交谈并询问他们您需要做什么允许中继,或从内部服务器配置尽可能中继。基本上问题不是你的代码,而是配置。
You need to speak to whoever administers the smtp server you are using and ask them what you need to do to allow relaying, or to configure relaying as possible from internal servers. Basically the problem isn't your code, it is configuration.


你确定smtp没有被防火墙阻止吗?
Are you sure that smtp is not blocked by firewall?


这篇关于无需凭据即可向多个域发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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