Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Enabling SMTP on IIS 6.0 for Classic ASP

Posted on 2008-06-11
19
2,800 Views
Last Modified: 2013-11-30
Greetings Experts,

I have created a script in classic ASP to send data collected via a web form in an email.  I now need to enable and configure SMTP on IIS 6.0 but I see two options to do this and I'm not sure which to choose.

a) First option is found in windows components->application server(details)->IIS(details)->SMTP service.  On Microsofts website it says this is for ASP.NET so my concern is: will it also work for classic ASP?

b) Second option is windows components->email services.  This option says it enables both POP3 and SMTP but I'm not sure if this will suffice for sending out emails with ASP.

So that it's clear, my goal is to be able to send outgoing emails carrying webform data; I'm not so concerned with receiving emails at this point but if it's just as easy to configure for both, I'll do it.

Thanks for the help!
0
Comment
Question by:max7
  • 9
  • 7
  • 2
  • +1
19 Comments
 
LVL 15

Expert Comment

by:dosth
ID: 21767242
what email component you are using? if it is cdo message i think you can still able to send mail
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21767858
SMTP is just a relay - you need to either configure SMTP via the console or set in code where you are relaying to - either another SMTP server or an email server
0
 
LVL 22

Expert Comment

by:cj_1969
ID: 21768961
All you need is the IIS version ... both installs will install the same SMTP, the second option is just installing a POP program in addition to SMTP so that you can create mailoxes for receiving email on the server ... you don't need this.

You will need to make sure that you have the code for sending smtp based email ... the install from IIS is just the server relay with no client app.

For receiving emails ... if you have no other option, then go with option 2 ... this will allow you to set up mailboxes for incoming emails ... it's not pretty and doesn't have many features but it works.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 1

Author Comment

by:max7
ID: 21769811
>>>You will need to make sure that you have the code for sending smtp based email ... the install from IIS is just the server relay with no client app.

I have a script written in ASP that uses Persits ASP Email -- is this what you mean when you mention I need the code for sending SMTP based email?

Sounds like I should set up email services (option 2) since it will give me both the ability to send and receive.

Won't I need to call my ISP for a DNS server IP and host name for relay mail?
0
 
LVL 1

Author Comment

by:max7
ID: 21774507
Fyi, I installed email services (option 2) and then tested my script by filling out the web form and submitting it.  No emails were received at either email address specificed in my script and I couldn't see any obvious errors.  Perhaps I need to configure the SMTP?  Any thoughts on things to check?
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21776603
the best way to do that is configure it in code because if you change web servers, the code will still point to an email server/relay. So if using CDO, a sample VB script would be:

Dim oMail
oMail = Server.CreateObject("CDO.Message")
oMail.From = "me@whatever.com"
oMail.To = "me@whatever.com"
oMail.Subject = "xxxxxr"
oMail.Body = "xxxxx"
oMail.importance = 1
oMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "servername"
oMail.Configuration.Fields.Update
oMail.Send()
oMail = ""

So in the script outlined, you specify the email server or SMTP server relay. This will allow you to send email. From experience it is best to keep things simple like that, as opposed to setting imapi/pop and trying to configure the SMTP service from recieving mails also - you can script an imapi client to do that but outside of IIS/SMTP services.
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21776613
you will also need to ensure that firewalls or anti-virus software on the web server is not blocking port 25
0
 
LVL 1

Author Comment

by:max7
ID: 21782979
>>>the best way to do that is configure it in code because if you change web servers, the code will still point to an email server/relay.

Excellent suggestion.  What would be the placement of the code sample you give above in the context of my full script i.e. after the Dim strMessage but before Set objMail or elsewhere?
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21788200
Thanks max7.

Not sure I understood your last question. You could put the above code into a function so you can easily use anywhere in your code.
0
 
LVL 1

Author Comment

by:max7
ID: 21788790
>>>Not sure I understood your last question.

No worries, sometimes I'm not even sure of my own questions!  I'm terribly new at scripting so please forgive.  

I think I understand what your saying but just to be sure, I've attached a sample of the script I wrote and I would really appreciate seeing placement within it for this code you provided.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
 
<% 
Dim strMessage
 
strMessage = strMessage & "Name = " & Request.Form("Name") & vbCrLf
strMessage = strMessage & "Email = " & Request.Form("Email") & vbCrLf
strMessage = strMessage & "Home Phone = " & Request.Form("HomePhone") & vbCrLf
strMessage = strMessage & "Work Phone = " & Request.Form("WorkPhone") & vbCrLf
strMessage = strMessage & "Cell Phone = " & Request.Form("CellPhone") & vbCrLf
strMessage = strMessage & "Date = " & Request.Form("Date") & vbCrLf
strMessage = strMessage & "Guests = " & Request.Form("Guests") & vbCrLf
strMessage = strMessage & "Wedding = " & Request.Form("Wedding") & vbCrLf
strMessage = strMessage & "Comments = " & Request.Form("Comments") & vbCrLf
 
Set objMail = CreateObject("CDO.Message") 
 
With objMail
  .Subject = "Contact Us Form Data"
  .From = "anyone@anywhere.com"
  .To = "myemail1@max7.com"
  .Cc = "myemail2@max7.com"
  .TextBody = strMessage
  .Send 
End With
 
Set objMail = Nothing
 
response.Redirect("http://www.yahoo.com")
%>
 
</body>
</html>

Open in new window

0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21791668
I stuck in the 2 extra lines below :)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
 
<body>
 
<% 
Dim strMessage
 
strMessage = strMessage & "Name = " & Request.Form("Name") & vbCrLf
strMessage = strMessage & "Email = " & Request.Form("Email") & vbCrLf
strMessage = strMessage & "Home Phone = " & Request.Form("HomePhone") & vbCrLf
strMessage = strMessage & "Work Phone = " & Request.Form("WorkPhone") & vbCrLf
strMessage = strMessage & "Cell Phone = " & Request.Form("CellPhone") & vbCrLf
strMessage = strMessage & "Date = " & Request.Form("Date") & vbCrLf
strMessage = strMessage & "Guests = " & Request.Form("Guests") & vbCrLf
strMessage = strMessage & "Wedding = " & Request.Form("Wedding") & vbCrLf
strMessage = strMessage & "Comments = " & Request.Form("Comments") & vbCrLf
 
Set objMail = CreateObject("CDO.Message") 
 
With objMail
  .Subject = "Contact Us Form Data"
  .From = "anyone@anywhere.com"
  .To = "myemail1@max7.com"
  .Cc = "myemail2@max7.com"
  .TextBody = strMessage
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "servername"
  .Configuration.Fields.Update
  .Send 
End With
 
Set objMail = Nothing
 
response.Redirect("http://www.yahoo.com")
%>
 
</body>
</html>

Open in new window

0
 
LVL 1

Author Comment

by:max7
ID: 21794873
Good deal -- so basically, I can take this script to whatever server and rest easy that it will send the emails not matter without having to mess with configure the SMTP?
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21800379
yep thats the one :)

The "servername" can be another SMTP relay( that points to an email server) or be an actual email server itself. For example if it was an exchange server, it may have to have an additional option enabled or installed to accept incomming SMTP traffic from the web server.

Will also need to doublecheck that port 25 is not being blocked by anti-virus software.
0
 
LVL 22

Expert Comment

by:cj_1969
ID: 21802521
There was never a question of configuring SMTP to make it send emails ... the server side is completely seperate from the client side.  To send emails from your code you need the client app ... that is what the script you are working on does.  

You still need to configure the SMTP server and if you want to receive emails, the POP serices also.  You still need to configure and maintain these ... they do not have to reside on the same server as IIS (or the email client machine) ... no matter what you did to make the code work, you could always take it to another web server and make it run ... it would still point to your email (SMTP) server.

Just clarifying ... I don't want you to think that the client code is in any way "hooked" to the server side that this question was asking about.
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21802683
have another read of the original question cj_1969:
-----"I now need to enable and configure SMTP on IIS 6.0"
So there was a question of configuring SMTP

You said:
-----"You still need to configure the SMTP"
that is incorrect because settings are now being specified in code
0
 
LVL 1

Author Comment

by:max7
ID: 21810043
>>>that is incorrect because settings are now being specified in code

I will readily admit this dialogue is mostly above my level of knowledge right now but I would like to confirm that the above statement is accurate.
0
 
LVL 7

Accepted Solution

by:
Dauhee earned 500 total points
ID: 21810700
Well I can confirm that Windows 2003 server (as in your case with  IIS 6, but also for windows 2000) does not need to be configured via the GUI for SMTP :)
0
 
LVL 1

Author Closing Comment

by:max7
ID: 31466453
Good enough for me; thanks so much for your patience and effort with this.  I learned a lot!
0
 
LVL 7

Expert Comment

by:Dauhee
ID: 21829514
No prob it was a pleasure glad to be of service :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
is this a cms? 8 67
HTTPSendRequest with WinINet delays on first call 11 32
Hide cell in a table 2 27
alert(innerHTML); 8 32
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question