« Previous Next »

Thread: Setting up SMTP on IIS 7

Last post 10-24-2009 11:15 PM by steve schofield. 8 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (9 items)

Sort Posts:

  • 04-21-2009, 10:30 AM

    • robasta
    • Not Ranked
    • Joined on 04-21-2009, 2:21 PM
    • Posts 4

    Setting up SMTP on IIS 7

    Great, IIS7 is supposed to make my life easier, right? WRONG! I have just spent about 3hr trying to figure out how to setup SMTP virtual server. I have the SMTP running but IIS manager doesnt show the virtual smtp server like in iis6.

     no help out there...

    I am running win2k8 server and IIS 7.

     

    please help.

  • 04-21-2009, 12:03 PM In reply to

    • robasta
    • Not Ranked
    • Joined on 04-21-2009, 2:21 PM
    • Posts 4

    Re: Setting up SMTP on IIS 7

     Okay, got it running. here's how:

    1. start->administrative tools->server manager, go to features, select "add features", tick "smtp server" (if it is not already installed), choose to install the required "remote server admin toos"

    2. check to confirm that "Simple Mail Transfer Protocol (SMTP)" service is running, if so, we are good to go.

    3. start->administrative tools>internet info services(iis) 6.0

    4. make sure that SMTP virtual server/default smtp server is running, if not, right click, then choose "start"

    5. in IIS7,  go to website/virtual directory, double click "SMTP E-mail", Click on "Deliver e-mail to SMTP server", check the "Use localhost" checkmark

    6.Your code should be LIKE:

                SmtpClient serv = new SmtpClient();
                MailMessage msg = new MailMessage();
                msg.To.Add("toadrr@domain.com);
                msg.Body = "body";
                msg.Subject = "subj";
                msg.BodyEncoding = System.Text.Encoding.ASCII;
                msg.IsBodyHtml = isHTML;
                serv.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
               serv.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["SmtpServerUserName"], ConfigurationManager.AppSettings["SmtpServerPassword"]);
                 serv.Send(msg);

     

    --->My app is now sending emails. The first email spent about 30 min in the Queue folder, but after that, each email is sent straight away. (this is working for testing purposes, i am not sure if i should use this setup in a production environment - please advise)

     

    ciao

     

  • 04-21-2009, 12:25 PM In reply to

    Re: Setting up SMTP on IIS 7

    check event log.. if the mail stuck in queue, meaning smtp is still trying to deliver it... it could be remote host not contactable, etc..
    Cheers,
    Bernard Cheah
  • 07-10-2009, 8:00 AM In reply to

    • ekerner
    • Not Ranked
    • Joined on 07-10-2009, 11:33 AM
    • Posts 8

    Re: Setting up SMTP on IIS 7

    Mate! Get one thing very clear in your mind right now if you wanna be an IT devloper ...

    Nothing microsoft makes your life easy! Especially upgrades.

    They encourage you to upgrade at every turn, but trust every time you do something will break, and not just any something, microsoft technologies will break other already established microsoft technologies.

     The MS heads would argue, but first answer this ...

    1: Who in their right mind would change the packaged mail interface fom CDONTS, to CDO, to NOTHING, with each web server upgrade thus making (how many? Millions of) websites broken. What world has the resources to cope with such epic scale code upgrades?

    2: Who in their right mind would encourage a technology upgrade that CHANGES WEBPAGE NAMES from *.asp to *.aspx? Do they get that millions of established websites have spent years making links all over the web to their sites, only to have MS in their wisdom try their hardest to UNDO ALL OF THEIR HARD WORK?

    Mate Ive been a developer for 15 years and if you want my advise, install Apache on your windoze OS and learn how to use it - ONCE ONLY. You can then use some sensible languages and technologies very easily and with portability. You can configure Apache to leave your pages named *.asp so your web links still work. Apache supports everything you will ever need. Free. IIS is a babies suckie toy next to Apache.

    Soon you will also ditch the windoze server OS for a linux server OS and your life will be bliss.

    You can all dispute all you like but honestly MS are idiots who have been continually making developers lives hell for their entire history and wont learn. The only reason Im here is because a client of mine requires that I maintain their ASP site, if thats even a sentence.

    Anyway the answer to your mail problem (or rather MS's mail stuffup) is: http://weblogs.asp.net/steveschofield/archive/2006/12/19/iis7-post-23-vista-and-smtp-server-where-is-it.aspx

    Best Regards,

    Eugene Kerner.

  • 07-21-2009, 8:24 AM In reply to

    Re: Setting up SMTP on IIS 7

    Bravo! mate :)

    Cheers,
    Bernard Cheah
  • 09-16-2009, 10:16 AM In reply to

    Re: Setting up SMTP on IIS 7

    Hello, i am trying to setup iis 7 with smtp server from 2 weeks, but i couldn't i searched alot on the internet for help but i didn't enough help to setup i installed iis7 on windows vista also installed smtp free server and smart mail tools can you tell me step by step how to setup iis 7 with smtp i will be really grateful
  • 09-23-2009, 12:29 AM In reply to

    • ekerner
    • Not Ranked
    • Joined on 07-10-2009, 11:33 AM
    • Posts 8

    Re: Setting up SMTP on IIS 7

    Hi,

    You need to install a mail server (I use hMailServer which is open source and great) read the doco, understand it, and set it up as per your requirements.

    Then, the mail server is completely unrelated to your IIS and runs as a service - usually on ports 25 for SMTP, 110 for POP, and 143 for IMAP. YOU WILL NEED TO SELECT "Start->Control Panel->Allow a program through the firewall" AND MAKE ENTIRES FOR EACH SAID PORT.

    Then, you will call the mail service as follows, depending on your code language : -

    For Classic ASP you will use one of CDONTS or CDO (Google them for examples).

    For ASP.NET setup see "Control Panel->System and Maintenance->Administrative Tools->IIS Manager->ASP.NET->SMTP Mail".

    Note that if you want webmail thats another app again. Mailbee is OK, free for small volume use, and comes in ASP.NET.

    All the best,

    Eugene.

     

  • 10-24-2009, 12:30 PM In reply to

    Re: Setting up SMTP on IIS 7

    robasta:

    3. start->administrative tools>internet info services(iis) 6.0

     

    The guys from microsoft really wanna tell me that they developed a Windows 2008 Webserver Edition which has not the possibility to send out e-mails?

    Is there any webapplication around in the world which is not sending out e-mails?

    I have to use IIS7 and IIS6 at the same time? Or i have to use another third party application? Holy *** - i can not believe that!!!!!!  What about performance and security?

    (as far as i remember i just deinstalled all IIS6 settings to ad "FTP Publishing feature(lol)" to a IIS7 Website.) Damn!!

  • 10-24-2009, 11:15 PM In reply to

    Re: Setting up SMTP on IIS 7

    I'm not sure what you are talking about.  Vista / Win7 don't have a SMTP server available, IIS has a way to configure for applications to forward messages.  That is in IIS manager. 

    As far as SMTP feature, you have to make sure you allow local host send message by adding the IIS_IUSRS or application pools full access to the c:\inetpub\mailroot\pickup folder.  Secondly, your ISP has to allow port 25 access to send email.  mail servers totally rely on DNS for resolution, if something isn't working, enable logging and see what the error is.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
Page 1 of 1 (9 items)
Microsoft Communities