Jump to content

Check out our Community Blogs

Mukesh's Content

There have been 1 items by Mukesh (Search limited from 25-February 20)

Sort by                Order  

#664416 C# - Sending Email Through SMTP.

Posted by Mukesh on 03 October 2013 - 07:04 AM in C# Tutorials

Hello All,


I Have followd  the step of sening email through smtp.


i coded like below


protected void btnSubmit_Click(object sender, EventArgs e)

        NetworkCredential cred = new NetworkCredential("info@jjinteriorsdelhi.com", "xxxxxxx");
        MailMessage Msg = new MailMessage();
        Msg.From = new MailAddress("info@jjinteriorsdelhi.com");
        Msg.Subject = "Enquiry for Interior Design";
        string sMessage = "Dear  Admin, <br /><br />"
        + "Another user seeking for interior design through www.jjinterirorsdelhi.com<br /><br />";
        sMessage += "<u>Following are the User details :</u><br /><br /> Name: " + txtName.Text
        + "<br />Email: " + txtEmail.Text
        + "<br />Phone: " + txtPhone.Text
        + "<br />Message: " + txtMsg.Text;
        Msg.Body = sMessage;
        SmtpClient client = new SmtpClient("smtp.live.com", 995);
        client.Credentials = cred;
        client.EnableSsl = true;
        lblSendMsg.Visible = true;
        lblSendMsg.Text = "Your Enquiry has been sent sucessfully. Thank you";


Then it throw error like below--


A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond


how can i Solve it.



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download