在服务器上发送邮件 [英] sending mail on server
本文介绍了在服务器上发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在服务器上发送电子邮件,但收到发送邮件失败的错误。
无法理解有什么问题请帮帮我。
这里是代码
尝试
{
MailMessage mail = new MailMessage(Txtfromaddress.Text,contact@logicalkeys.com );
mail.Subject = Txtname.Text;
mail.Body = Txtmesage.Text;
SmtpClient客户端=新的SmtpClient();
client.Send(mail);
}
catch(Exception ex)
{
errormessage.InnerText = ex.Message;
}
web.config
< mailSettings >
< smtp deliveryMethod = 网络 >
< network host = smtp.mail.logicalkey.com userName = contact @ logicalkeys .com 密码 = acbgtsd enableSsl = true / >
< / smtp >
< / mailSettings >
解决方案
< blockquote>您的邮件服务器是否使用SSL证书?如果否,则尝试从web.config文件中删除enableSSL = true
尝试使用在webconfig seetings中打开的端口号,例如
< network host =smtp.mail.logicalkey.comport =25username =contact@logicalkeys.compassword =acbgtsdenablessl =true/ >
端口号应根据您的设置进行更改
http://www.planetmagpie.com/networksupport/whatyouneed/emailsettings/changesmtpport.aspx [ ^ ]
如果问题仍然存在,请检查防火墙设置
i am trying to sending email on server but getting error of "failure send mail".
cant understand what is the problem please help me out.
here is code
try { MailMessage mail = new MailMessage(Txtfromaddress.Text,"contact@logicalkeys.com"); mail.Subject = Txtname.Text; mail.Body = Txtmesage.Text; SmtpClient client = new SmtpClient(); client.Send(mail); } catch (Exception ex) { errormessage.InnerText = ex.Message; }
web.config
<mailSettings >
<smtp deliveryMethod="Network">
<network host="smtp.mail.logicalkey.com" userName="contact@logicalkeys.com" password="acbgtsd" enableSsl="true" />
</smtp>
</mailSettings>
解决方案
Is your mail server using SSL Certificate? If no then try removing the enableSSL=true from the web.config file
Try using a port number which is open inside the webconfig seetings like
<network host="smtp.mail.logicalkey.com" port="25" username="contact@logicalkeys.com" password="acbgtsd" enablessl="true" />
Port number should be changed as per your settings
http://www.planetmagpie.com/networksupport/whatyouneed/emailsettings/changesmtpport.aspx[^]
If still the problem persists check your firewall settings
这篇关于在服务器上发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文