本文介绍了在服务器上发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试在服务器上发送电子邮件,但收到发送邮件失败的错误。 无法理解有什么问题请帮帮我。 这里是代码 尝试 { MailMessage mail = new MailMessage(Txtfromaddress.Text,[email protected] ); 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 > 解决方案 您的邮件服务器是否使用SSL证书?如果否,则尝试从web.config文件中删除enableSSL = true 尝试使用在webconfig seetings中打开的端口号,例如 < network host =smtp.mail.logicalkey.comport =25username [email protected] =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 codetry { MailMessage mail = new MailMessage(Txtfromaddress.Text,"[email protected]"); 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="[email protected]" 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 fileTry using a port number which is open inside the webconfig seetings like<network host="smtp.mail.logicalkey.com" port="25" username="[email protected]" password="acbgtsd" enablessl="true" />Port number should be changed as per your settingshttp://www.planetmagpie.com/networksupport/whatyouneed/emailsettings/changesmtpport.aspx[^]If still the problem persists check your firewall settings 这篇关于在服务器上发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-23 18:21