Unable to successfully use System.Net.Mail to send an email

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PeterRankin
    New Member
    • Jul 2010
    • 4

    #1

    Unable to successfully use System.Net.Mail to send an email

    I am writing a C# application in VS2008 that requires notification emails to be sent from time to time. I am using the System.Net.Mail namespace but so far I have been unsuccessful in trying to send an email. I construct the message with its From, To, Body, and Subject fields fine. Then comes the client code:

    SmtpClient client = new SmtpClient("xx. xx.xx", 465);
    client.EnableSs l = true;
    client.Send(mes sage);

    There is no username or password with this SMTP account. I have tried the UseDefaultCrede ntials with no success. I have also tried pasting xml into my app.config file with no success.

    Thanks for taking time to read this. Any ideas would be appreciated!
  • PeterRankin
    New Member
    • Jul 2010
    • 4

    #2
    Solution

    I found the solution to my problem. I downloaded sample source code:



    I looked at how this project was set up, and I set up my project that way, and now it works.

    Comment

    Working...