[language =c#]
System.Net.Mail.MailMessage myMail = new System.Net.Mail.MailMessage();
        myMail.To.Add("someemailid.com");
        myMail.From = new MailAddress("someemailid@someemailid.com", "someemailid ", System.Text.Encoding.UTF8);
        myMail.Subject = "user Information";
        myMail.SubjectEncoding = System.Text.Encoding.UTF8;

        SmtpClient client = new SmtpClient();
        client.Host = "localhost";
        client.Port = 25;
        client.Send(myMail);

The above code i have used in asp.net page
Its showing client.Send(myMail) failed
//////////////////
the below code i have used in web.config file

<system.net>
    <mailSettings>
      <smtp from="customercare@mailaddress.com">
        <network host="smtp.mail.mailaddress.com" port="25" userName="something" password="pass" defaultCredentials="true" />
      </smtp>
    </mailSettings>
  </system.net>[/language]

Recommended Answers

All 2 Replies

What is the error message that you receive?

You should not send email in response to a user's action. You should queue it and have a service process the queue every minute and send out the emails.

boss the error message i am getting is client.send(message) failed

Its not saying anything apart from that


One more thing for search engine optimization in HTML they use meta tags right.

In the same way we can use keywords(some code) in web.config file it seems
by team leader told . I am unable to find any such code

Help me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.