Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I Login And Try To Send Mail..
When I run this code it shows the following error:

"Server Does Not Support Secure Connections."

The error comes on "Smtp.Send(Ml)":

protected void btnSend_Click(object sender, EventArgs e)
        {
            MailMessage ml = new MailMessage();
            ml.From = new MailAddress(Session["EmailId"].ToString().Trim());
            ml.To.Add(txtEmaillTo.Text);
            ml.Subject = txtSubject.Text;
            string Bd = txtMessageBody.Text;
            ml.Body = Bd;
            ml.IsBodyHtml = true;
            if (FileUpload1.HasFile)
            {
                ml.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
            }
            SmtpClient smtpcode = new SmtpClient();
            smtpcode.Host = "10.10.10.248";
            smtpcode.Port = 25;
            smtpcode.UseDefaultCredentials = false;                      
            smtpcode.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
            smtpcode.Credentials = new System.Net.NetworkCredential(Session["EmailId"].ToString().Trim(), Session["Password"].ToString().Trim());
            smtpcode.Timeout = 20000;
            smtpcode.EnableSsl = true;             
           
                smtpcode.Send(ml);
                lblmessage.Visible = true;
                lblmessage.ForeColor = Color.Green;
                lblmessage.Text = "Message send successfully";                
         }
Posted
Updated 28-Sep-14 22:49pm
v2

1 solution

try below things.

smtpcode.EnableSsl = false;
 
Share this answer
 

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