Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2881
  • Last Modified:

Enabling SMTP on IIS 6.0 for Classic ASP

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
max7
Asked:
max7
  • 9
  • 7
  • 2
  • +1
1 Solution
 
dosthCommented:
what email component you are using? if it is cdo message i think you can still able to send mail
0
 
DauheeCommented:
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
 
cj_1969Commented:
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
max7Author Commented:
>>>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
 
max7Author Commented:
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
 
DauheeCommented:
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
 
DauheeCommented:
you will also need to ensure that firewalls or anti-virus software on the web server is not blocking port 25
0
 
max7Author Commented:
>>>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
 
DauheeCommented:
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
 
max7Author Commented:
>>>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
 
DauheeCommented:
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
 
max7Author Commented:
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
 
DauheeCommented:
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
 
cj_1969Commented:
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
 
DauheeCommented:
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
 
max7Author Commented:
>>>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
 
DauheeCommented:
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
 
max7Author Commented:
Good enough for me; thanks so much for your patience and effort with this.  I learned a lot!
0
 
DauheeCommented:
No prob it was a pleasure glad to be of service :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 7
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now