Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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]
Posted
Updated 2-Mar-12 21:00pm
v3
Comments
Varun Sareen 3-Mar-12 2:53am    
edit for: removed pre tag
Varun Sareen 3-Mar-12 2:59am    
STARTTLS is a sendmail command to initiate a secure connection. So it looks like you need to do one of those.
OriginalGriff 3-Mar-12 3:01am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
ajit_machhe 5-Mar-12 0:17am    
if you are using Gmail try port 465.

1 solution

i used below code in web application.
C#
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;
        }
    }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900