发送SMTP邮件客户端和服务器无法通信,因为它们不具有通用算法SMTP
我正在尝试使用SMTP生成电子邮件,但我不想添加Creadentials我的代码。在我本地的PC上工作正常,但是在服务器上,
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(SmtpServer_con);
mail.From = new MailAddress(MailFrom);
mail.To.Add(emailToID);
htmlString = @"<html><body>";
htmlString = htmlString + EmailBody;
htmlString = htmlString + "</body></html>";
mail.Subject = EmailSubject;
mail.Body = htmlString;
mail.IsBodyHtml = true;
if (SenderEmailID.ToString() != "")
{
SmtpServer.Credentials = new System.Net.NetworkCredential(SenderEmailID, SenderEmailPassword);
SmtpServer.Port = int.Parse(Port);
if (SSL == "1")
{
SmtpServer.UseDefaultCredentials = true;
}
else
{
SmtpServer.UseDefaultCredentials = false;
}
}
else
{
SmtpServer.UseDefaultCredentials = true;
}
try
{
SmtpServer.Send(mail);
CtlCommon.CreateErrorLog("GenerateEmail ", "Sent Succesfully");
}
如果我将SSL设置为TURE,
则会给我错误失败发送电子邮件客户端和服务器无法通信,因为它们不具有通用算法
,如果我将SSL用作false并尝试使用我的凭据,我会遇到以下的错误
SMTP服务器需要安全连接或未对客户端进行身份验证5.7.57
客户希望在没有凭据的情况下发送电子邮件
I am trying generate email using SMTP but i dont want to add creadentials my code. At my local PC is working fine but on server it is giving me error
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient(SmtpServer_con);
mail.From = new MailAddress(MailFrom);
mail.To.Add(emailToID);
htmlString = @"<html><body>";
htmlString = htmlString + EmailBody;
htmlString = htmlString + "</body></html>";
mail.Subject = EmailSubject;
mail.Body = htmlString;
mail.IsBodyHtml = true;
if (SenderEmailID.ToString() != "")
{
SmtpServer.Credentials = new System.Net.NetworkCredential(SenderEmailID, SenderEmailPassword);
SmtpServer.Port = int.Parse(Port);
if (SSL == "1")
{
SmtpServer.UseDefaultCredentials = true;
}
else
{
SmtpServer.UseDefaultCredentials = false;
}
}
else
{
SmtpServer.UseDefaultCredentials = true;
}
try
{
SmtpServer.Send(mail);
CtlCommon.CreateErrorLog("GenerateEmail ", "Sent Succesfully");
}
if i set ssl as true i am getting below errors
failure Sending Email the client and server cannot communicate because they do not possess a common algorithm
and if i use ssl as false and try to use my credentials i am getting below errors
the smtp server requires a secure connection or the client was not authenticated 5.7.57
Client wants to send email without credentials
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论