邮件未在我的应用程序中发送 [英] Mail is not sendind in my application
本文介绍了邮件未在我的应用程序中发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我在Windows应用程序中工作..我的应用程序具有邮件发送功能..我已经为我们的客户安装了此应用程序..当我发送邮件时,系统邮件已成功发送..但是当客户端发送邮件时,它会显示错误
错误:
服务器响应为:5.7.0必须首先发出starttls命令.
有什么解决方案对我有帮助吗?
[edit] SHOUTING已删除-OriginalGriff [/edit]
Hi
Im working in windows application..my application has mail sending facility..i have installed this application fir one our clients..when i send mail im ny system mail is sent succesfully..but when the client send the mail it is showing the error
Error:
The server response was: 5.7.0 must issue a starttls command first.
Is there any solution for it help me
[edit]SHOUTING removed - OriginalGriff[/edit]
推荐答案
i在Web应用程序中的以下代码中使用.
i used below code in web application.
protected bool Send(string To, string From, string Subj, string Msg)
{
try
{
string mFrom = From.ToString().Trim();
string mTo = To.ToString().Trim();
string mSubject = Subj.ToString().Trim();
string mMsg = Msg.ToString().Trim();
string mMailServer = ConfigurationManager.AppSettings.Get("SMTP");
int mPort = Convert.ToInt32(ConfigurationManager.AppSettings.Get("PORT"));
MailMessage message = new MailMessage(mFrom, mTo, mSubject, mMsg);
SmtpClient mySmtpClient = new SmtpClient(mMailServer, mPort);
// mySmtpClient.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["FROMEMAIL"], ConfigurationManager.AppSettings["FROMPWD"]);
//mySmtpClient.EnableSsl = true;
message.Priority = MailPriority.High;
mySmtpClient.UseDefaultCredentials = true;
mySmtpClient.Send(message);
return true;
}
catch (Exception ex)
{
return false;
}
}
这篇关于邮件未在我的应用程序中发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文