Skip to content

Configuring smtp mailSettings

Milton Smith

Asked May 16, 2008, 1:46 PM EDT6 answers
Share
LinkedInX
How do i configure smtp mailsettings in web.config?

5 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Niradhip Chakraborty
    0

    <system.net>
      <mailSettings>
       <smtp>
        <network host="SMTP.1and1.com" userName="[email protected]" password="sam"/>
       </smtp>
      </mailSettings>
     </system.net>


    change the host name username and password as per your need.

    0
  • 0
    Thanks james can you give me the code to send mail.
    0
  • Niradhip Chakraborty
    0
    Java
    string strFrom = null;
    strFrom =" [email protected]";
    strTo= " [email protected]";
    MailMessage mlMsg = new MailMessage(strTo, strFrom);
    mlMsg.Subject = "Request for the Information";
    SmtpClient emailClient = new SmtpClient();
    emailClient.Send(mlMsg);
    0
  • 0
    Thank you James for your reply. But I am geting error!!!!!!!!! oops. Do I need to add anything more.
    0
  • Niradhip Chakraborty
    0

    Please add the namespace

    using System.Net.Mail;

    0
  • 1 short reply
    • 0
      Thanks James. Works fine.
      0