During troubleshooting a Storefront installation it is
often handy to be able to check if the CDONTS component is working
properly.
We have created a two page script that will allow you to
test CDONT's functionality. The first page called
email.asp is simply a html page with a built-in form to gather
up what information is to go into the email and who it is going to.
The second page called preview.asp tests for a secret password you
assign, then either redirects you back to the opening page (email.asp)
with an error message or if your password is correct displays to you
the email that has been sent.
We have assumed that both of these
files will be placed in a folder called "toolz", but by changing
some of the links, you can customize this to whatever your want. |
|
| Here is the code for email.asp |
<%
if request("bad")=1 then response.write "<font face=Arial size=3
color=#FF0000>you have tried to access a private page</font>"
%>
<html>
<head>
<title>Email testing</title>
</head>
<body bgcolor="#FAE2C0">
<p><br>
This form will generate an email to anybody from anybody.</p>
<form method="POST" action=../toolz/preview.asp>
<p>Enter your password to use this tool:<br>
<input type="password" name="password" size="10"></p>
<p>Email to:<br>
<input type="text" name="email" size="50"><br>
Email
From:
(you may have to put in some
spaces here)
Custom Email From:<br>
<select size="1" name="emailfrom">
<option value="info@yourdomain.com" selected>info@yourdomain.com</option>
<option value="yourname@yourdomain.com">yourname@yourdomain.com</option>
<option value="a.different.name@ourdomain.com">a.different.name@ourdomain.com</option>
</select> <font color="#F060A5" size="1"><--Choose only
one--></font>
<input type="text" name="customemailfrom" size="40"></p>
<p>Subject
Line:
Alternate Subject Line<br>
<select size="1" name="subject">
<option value="email test">email test</option>
</select> <font
size="1"> <font color="#F060A5"><--Choose
only one--> </font> </font>
<input type="text" name="altsubject" size="50"></p>
<p><u>Body Section<br>
</u>Opening Remarks:<br>
<textarea rows="3" name="openremark" cols="50"></textarea><br>
<input type="submit" value="submit- this is a one shot deal"
name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
<p> </p>
</body>
</html> |
| See a sample of this page
(email functionality has
however been disabled) |
|
| Here is the code for preview.asp: |
<%
password=request("password")
if password="secretpassword" then '-----here is where we insert our
secret password
response.write "correct password, below is what has been sent<br><br>"
else
response.redirect("email.asp?bad=1")
end if
email=request("email")
response.write "email to: " & email & "<br>"
emailfrom=request("emailfrom")
response.write "email from: " & emailfrom & "<br>"
customemailfrom=request("customemailfrom")
response.write "custom email from" & customemailfrom & "<br>"
'----decide who the email is from
If len(customemailfrom)>7 then
email_from=customemailfrom
else
email_from=emailfrom
end if
subject=request("subject")
response.write "subject line: " & subject & "<br>"
altsubject=request("altsubject")
response.write "alternate subject: " & altsubject & "<br>"
'-- decide what the subject line will be
if len(altsubject)>1 then
subject_line=altsubject
else
subject_line=subject
end if
openremark=request("openremark")
response.write "opening remarks in the body of the email<br>" &
openremark & "<br>"
mailbody="<body bgcolor=#FAE2C0>" & openremark
Response.write "<br>**************************************************<br>"
response.write mailbody
Set sendmail = Server.CreateObject("CDONTS.NewMail")
sendmail.From = email_from
sendmail.To = email
sendmail.Subject=subject_line
sendmail.bodyformat = 0 'html
sendmail.MailFormat = 0 ' without this line the html doesn't work
sendmail.Body= mailbody
sendmail.Importance = 1
sendmail.Send
Set sendmail = Nothing
%>
|
| |
| |
| If you have gone through every possible scenario or variation of
trying to get email working on your IIS 5 server, here is one more
last tidbit. If your server is running in medium (pooled) mode
then it is critical |
| to set permissions correctly on the mail folders. To test if
this is the case, temporarily put the server |
| into low (iis process) application protection mode. If the mail
flows in this circumstance then you need to adjust the mail root permissions (hint everyone= iusr_machinename +
iwam_machinename) |
| |
| |