none
Sending Mail with Vista Business, IIS 6 and .NET

    Question

  • So I am having a problem sending mail from a .NET app.  I keep getting a timeout issue - I have selected the 'use localhost' option for port 25 to deliver e-mail to SMTP server.  I have assigned all the neccesary To, From, Body, SMTPServer, etc. but the app just hangs until the timeout occurs and that's it.

     

    I also tried to disable my firewall and tried to rerun the app but I got the same result.

     

    Any ideas?  I wonder if this is an IIS 6.0 / Vista issue or not....

    Wednesday, February 06, 2008 10:33 PM

Answers

  • Hello,

     

    I notice that you set the SMTP server as localhost. However, As far as I know, Simple Mail Transfer Protocol (SMTP) and POP3 servers have been removed from the IIS component in Windows Vista, namely, there is actually no SMTP services on the vista. So I think it is a possible reason that can explain why the program hangs till time out.

     

    Regards,

    Jialiang Ge

    Friday, February 08, 2008 8:44 AM
    Moderator

All replies

  • It would probably be helpful to see the code you are using.  Also are you using exception handling to trap errors to try to get more details about what is going on?

     

    Brandon Schenz

     

    Wednesday, February 06, 2008 11:36 PM
  • I made one error -- IIS is version 7.0

     

    I appreciate you answering my post.  I did not include code because I really wanted to focus on the IIS with Vista issue.  I really don't think the code has anything to do with the problem.  I am using a try...catch block and the error I catch is the one I listed above and here again --> "Timeout expired".  I assume it is set to 30 seconds in IIS or some other place.  Do you have any ideas?  I really have not worked with IIS 6. all that much.

     

    Here is an example of code that behaves the same way I have been experiencing....

     

    MailMessage msg = new MailMessage();

    msg.From = new MailAddress("info@samplesite.com");

    msg.To.Add("username@hotmail.com");

    msg.Subject = "test subject";

    msg.Body = "test body";

    SmtpClient smtp = new SmtpClient();

    smtp.Host = "127.0.0.1";

    smtp.Send(msg);

    Response.Write("Email was queued to disk");

     

     

    I think there is a problem with localhost.

    Thursday, February 07, 2008 3:33 AM
  • Brian,

    I have not worked with Vista/IIS7 personally.  My next step would be to ensure that the SMTP service is turned on, and is correctly configured.

    Thursday, February 07, 2008 3:58 AM
  •  

    That is my quandry...can someone suggest how IIS 7.0 should be configured?  Do I need to add my website to the 'Default Web Site'

     

    Suggestions?

    Thursday, February 07, 2008 4:05 AM
  • Hello,

     

    I notice that you set the SMTP server as localhost. However, As far as I know, Simple Mail Transfer Protocol (SMTP) and POP3 servers have been removed from the IIS component in Windows Vista, namely, there is actually no SMTP services on the vista. So I think it is a possible reason that can explain why the program hangs till time out.

     

    Regards,

    Jialiang Ge

    Friday, February 08, 2008 8:44 AM
    Moderator
  • It seems that Jialiang is correct.  SMTP will only be included with the Longhorn Server release and not on Vista.  There are many other free SMTP services that you may install though and the operation will be the same.
    Friday, February 08, 2008 1:34 PM
  • I found this out last night so Jialiang is correct.  I don't know why Microsoft would do this but what I did was reference the System.Net.Mail namespace and I created a folder under the IIS 7.0 > SMTP Email using 'localhost', port 25 and used the 'Store e-mail in pickup directory' option.

     

    Now I am able to get the e-mail I send from my application.  This works.  However, will I run into anything I need to configure when I upload this project to a server?

    Friday, February 08, 2008 3:34 PM
  • hi ,

    I need help in sending emails in ASP.NET . I have windows vista , so I installed Free smtp server and started the service from control panel . When i send the email in c# it doesnt display any error .However the email is not sent .I have no idea about IIS .I looked for it on my vista system , but looks like it doesnt have it .Do I need it for smtp ?Please suggest .

    Thanks
    Monday, October 13, 2008 9:15 PM