SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Set SMTP Options in Windows Server 2003

    Hi, I need your help.

    I've set up the virtual smtp server on my IIS 5.1 like so:

    1. Assign IP address to "All Unassigned", and listen to port 25.
    2. Access Connection granted to "127.0.0.1".
    3. Relay only allow "127.0.0.1".
    4. Authentication: "Anonymous access" only.
    5. Outbound connection listen to TCP 25.

    I used the following code, and

    Response.Write("Your E-mail has been sent sucessfully - Thank You")

    is executed and I don't see any exception.

    However, the mail never arrived!

    So, what's the problem?


    Code:
    <%
    
    schema = "http://schemas.microsoft.com/cdo/configuration/"
    Set objEmail = CreateObject("CDO.Message")
    With objEmail
    .From = "***@mydomain.com"
    .To = "***@mydomain.com"
    .Subject = "Test Mail"
    .Textbody = "The quick brown fox " & Chr(10) & "jumps over the lazy dog"
    With .Configuration.Fields
    .Item (schema & "sendusing") = 2
    .Item (schema & "smtpserver") = "localhost"
    .Item (schema & "smtpserverport") = 25
    .Item (schema & "smtpconnectiontimeout") = 10
    End With
    .Configuration.Fields.Update
    on error resume next
       .Send
       if Err.Number <> 0 then
         Response.Write("Email send failed # : " & Err.Number & " -  " & Err.Description & ".<br />"&vbcrlf)
       else
         Response.Write("Your E-mail has been sent sucessfully - Thank You.<br />"&vbcrlf)
       end if     
    End With
    
    %>

  2. #2
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    http://support.microsoft.com/kb/303734

    If you look in C:\inetpub, you should see various folders like "badmail", "Queue" and a few others. If you open the messages in a text editor, you can see if your messages are getting to the virtual SMTP and what some of the bounce messages might be if they aren't leaving the server.

    To allow the virtual SMTP in IIS to sent mail directly through the internet, DNS lookups need to be enabled and outbound port 25 needs to be open in any firewalls.

    However--I've typically just used the virtual SMTP as a LAN-only relay to an external email account, rather than using it to directly send out email.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    http://support.microsoft.com/kb/303734

    If you look in C:\inetpub, you should see various folders like "badmail", "Queue" and a few others. If you open the messages in a text editor, you can see if your messages are getting to the virtual SMTP and what some of the bounce messages might be if they aren't leaving the server.

    To allow the virtual SMTP in IIS to sent mail directly through the internet, DNS lookups need to be enabled and outbound port 25 needs to be open in any firewalls.

    However--I've typically just used the virtual SMTP as a LAN-only relay to an external email account, rather than using it to directly send out email.

    thank you for help.

    this is the SMTP logs:

    Code:
    #Version: 1.0
    #Date: 2013-11-19 08:42:43
    #Fields: time c-ip cs-method cs-uri-stem sc-status
    08:42:43 10.XX.XX.XX HELO - 250
    08:42:43 10.XX.XX.XX MAIL - 250
    08:42:43 10.XX.XX.XX RCPT - 250
    08:42:43 10.XX.XX.XX RCPT - 250
    08:42:43 10.XX.XX.XX DATA - 250
    08:42:43 10.XX.XX.XX QUIT - 240
    The message is Received but not working the relay:

    Code:
    Received: from XXXXXX ([XXXXXX]) by mydomain with Microsoft SMTPSVC(7.5.7600.16385);
    	 Tue, 19 Nov 2013 10:00:20 +0100
    Thread-Topic: test email 19/11/2013 9.57.54
    thread-index: Ac7lBW94CxIYsbtCSGCycUK8OhMa1A==
    X-MSMail-Priority: 6
    From: <*****@mydomain.com>
    To: <*****@mydomain.com>
    Cc: <*****@mydomain.com>
    Subject: test email 19/11/2013 9.57.54
    Date: Tue, 19 Nov 2013 09:57:54 +0100
    Message-ID: <E25CF2F4123A408DB726E5DD65BBE0D5@******>
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
    	boundary="----=_NextPart_000_01A2_01CEE50D.D13D63C0"
    X-Mailer: Microsoft CDO for Windows 2000
    Content-Class: urn:content-classes:message
    Importance: high
    Priority: normal
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3959
    Return-Path: *****@mydomain.com
    X-OriginalArrivalTime: 19 Nov 2013 09:00:20.0042 (UTC) FILETIME=[C60952A0:01CEE505]
    
    This is a multi-part message in MIME format.
    
    ------=_NextPart_000_01A2_01CEE50D.D13D63C0
    Content-Type: text/plain;
    	charset="iso-8859-1"
    Content-Transfer-Encoding: 7bit
    
    test email 19/11/2013 9.57.54
    
    ------=_NextPart_000_01A2_01CEE50D.D13D63C0
    Content-Type: text/html
    Content-Transfer-Encoding: 7bit
    
    test email 19/11/2013 9.57.54
    ------=_NextPart_000_01A2_01CEE50D.D13D63C0--

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Location
    OH, USA
    Posts
    72
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It looks like you script and virtual server works, but real email server not configured as relay for your virtual server. Usially mail servers allow realy emails only from restricted list of ip addresses

  5. #5
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gk53 View Post
    It looks like you script and virtual server works, but real email server not configured as relay for your virtual server. Usially mail servers allow realy emails only from restricted list of ip addresses
    Yes... and now ?

  6. #6
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Miguel61 View Post
    Yes... and now ?
    Did you want the virtual SMTP to act as a relay or a mail server?

    To act as a relay:


    1. Open IIS
    2. Right click on the virtual SMTP > Properties
    3. Go to the delivery tab.
    4. Click the "outbound security" button.
    5. Select "basic authentication" and enter the username and password for the external email account. Check TLS encryption if the account uses a secured connection.
    6. Click ok. This should bring you back to the delivery tab.
    7. Click the "outbound connections" button. You can specify the outbound email port for the external email account here.
    8. Click ok. This should bring you back to the delivery tab.
    9. Click the "advanced" button.
    10. For "masquerade domain" enter the external email account's domain (the part of the email address after the @ symbol).
    11. For "fully qualified domain name", enter the server's FQDN (myserver.mydomain.local)
    12. For "smart host", enter the external email account's SMTP address.
    13. Click ok, then ok again.


    Keep in mind--these instructions are for IIS 6.0, rather than 5.1, but if I recall, they should be fairly close.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  7. #7
    SitePoint Evangelist Miguel61's Avatar
    Join Date
    Mar 2008
    Posts
    402
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    Did you want the virtual SMTP to act as a relay or a mail server?

    To act as a relay:


    1. Open IIS
    2. Right click on the virtual SMTP > Properties
    3. Go to the delivery tab.
    4. Click the "outbound security" button.
    5. Select "basic authentication" and enter the username and password for the external email account. Check TLS encryption if the account uses a secured connection.
    6. Click ok. This should bring you back to the delivery tab.
    7. Click the "outbound connections" button. You can specify the outbound email port for the external email account here.
    8. Click ok. This should bring you back to the delivery tab.
    9. Click the "advanced" button.
    10. For "masquerade domain" enter the external email account's domain (the part of the email address after the @ symbol).
    11. For "fully qualified domain name", enter the server's FQDN (myserver.mydomain.local)
    12. For "smart host", enter the external email account's SMTP address.
    13. Click ok, then ok again.


    Keep in mind--these instructions are for IIS 6.0, rather than 5.1, but if I recall, they should be fairly close.
    Many thanks for help, but in the bdr file says:

    Unable to deliver this message because the follow error was
    encountered: "This message is a delivery status notification that
    cannot be delivered.".

    The specific error code was 0xC00402C7.


    The message sender was <>.


    The message was intended for the following recipients.

    I need configure the virtual SMTP to act as a relay

  8. #8
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,516
    Mentioned
    51 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Miguel61 View Post
    Many thanks for help, but in the bdr file says:

    Unable to deliver this message because the follow error was
    encountered: "This message is a delivery status notification that
    cannot be delivered.".

    The specific error code was 0xC00402C7.


    The message sender was <>.


    The message was intended for the following recipients.
    That is an error message for an error message. Basically, when an email can't be sent out, the virtual SMTP then attempts to sent out a notification that it can't send an email out. Then since that notification email can't be sent out, it generates another notification email saying that the notification message can't be sent--which is what you pasted above.

    I need configure the virtual SMTP to act as a relay
    The instructions I listed should do that.

    I didn't include instructions for setting it up as a stand-alone SMTP because I am unfamiliar with that process.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •