Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
{
                   MailMessage objemail = new MailMessage();
                   objemail.From = new MailAddress("admin@myindianhome.com");
                   objemail.To.Add(new MailAddress("getabdur4@gmail.com"));
                   objemail.Subject = "New Post Requirement added to our website";
                   objemail.IsBodyHtml = true;
                   objemail.Body = "<html><head>New Post Requirement</head><body><br/>" + "First Name : " + txtfirstname.Text + "<br/><br/>" + "Last Name : " + txtlastname.Text + "<br/><br/>" + "Email : " + txtemail.Text + "<br/><br/>" + "Mobile No : " + txtmobileno.Text + "<br/><br/>"
                                  + "City : " + txtcity.Text + "<br/><br/>" + "Propert Type : " + ddlpropertytype.Text + "<br/><br/>" + "Area : " + txtarea.Text + ddlareaunits.Text + "<br/><br/>" + "Unit Price : " + txtprice.Text + "</body></html>";
                   objemail.BodyEncoding = System.Text.Encoding.UTF8;
                   objemail.Priority = MailPriority.High;
                   SmtpClient client = new SmtpClient("relay-hosting.secureserver.net");
                   try
                   {
                       client.Credentials = new System.Net.NetworkCredential("admin@myindianhome.com", "administration");
                      client.Host = "Host";

                       client.Port = 25;

                       client.UseDefaultCredentials = false;
                       client.DeliveryMethod = SmtpDeliveryMethod.Network;
                       client.EnableSsl = false;
                       client.Timeout = 20000;

                       client.Send(objemail);
                   }
                   catch (Exception err)
                   {
                       Errmsg.Text = "<b>Unable to send: <font color=\"red\">" + err.Message + "</font></b><br/><br/>";
                       clear();



                   }
               }
Posted
Updated 11-Nov-14 19:40pm
v2
Comments
Sergey Alexandrovich Kryukov 12-Nov-14 1:34am    
Have you checked up credentials and SMTP options? To check it up, have you been able to send a mail through the same SMTP server and same credentials using some available mail client?
—SA
abdur0007 12-Nov-14 1:42am    
with gmail settings in local system it works perfectly. when I hosting in godaddy server it shows error
Sergey Alexandrovich Kryukov 12-Nov-14 2:14am    
Why gmail? I'm asking about the use of the same server, "relay-hosting.secureserver.net".
—SA

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