How can we configure smtp settings in web.config ?

How can we configure smtp settings in web.config ?

Asked on October 27, 2018 in Vb.net.
Add Comment


  • 2 Answer(s)

    Set IIS to forward your mail to the remote server. The specifics vary greatly depending on the version of IIS. For IIS 7.5:

    • Open IIS Manager
    • Connect to your server if needed
    • Select the server node; you should see an SMTP option on the right in the ASP.NET section
    • Double-click the SMTP icon.
    • Select the “Deliver e-mail to SMTP server” option and enter your server name, credentials, etc
    Answered on October 27, 2018.
    Add Comment
        SmtpClient smtpClient = new SmtpClient("smtp.sender.you", Convert.ToInt32(587));
        System.Net.NetworkCredential credentials = new System.Net.NetworkCredential("username",                            "password");
        smtpClient.Credentials = credentials;
        smtpClient.Send(msgMail);
    

    To this:

        SmtpClient smtpClient = new SmtpClient();
        smtpClient.Send(msgMail);
    

    Using the code we can configure the smtp settings in web.config .

     

     

     

     

     

     

     
    Answered on October 27, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.