1 year ago
#360433
abid Hussain
send SMTP mail the client and server cannot communicate because they do not possess a common algorithm smtp
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
c#
.net
smtpclient
0 Answers
Your Answer