Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email script doesn't send the email

Status
Not open for further replies.

shaunacg

Programmer
Aug 1, 2003
71
GB
Hi,

I have written an e-mail script and tested using response.write to confirm that the values were past to it from the form, and they were. It redirects to the thank-your page even without sending an error message, but the e-mail never sends. Do you know what I have done wrong?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim varFName, varLName, varPhone, varEmail, varQuery, varFrom, varSubject, varTo, varRedirect

varFName=Request.Form("FirstName")
varLName=Request.Form("LastName")
varPhone=Request.Form("Telephone")
varEmail=Request.Form("Email")
varQuery=Request.Form("Query")
varFrom=Request.Form("from")
varSubject=Request.Form("subject")
varTo=Request.Form("to")
varRedirect=Request.Form("redirect")

Dim ObjMail
Set ObjMail = Server.CreateObject("CDONTS.NewMail")
objMail.From = varFrom
objMail.To = varTo
objMail.Subject = varSubject
objMail.Body = "First Name: " & varFName & ""_
& VBCrLf & VBCrLf & "Last Name: " & varLName & ""_
& VBCrLf & VBCrLf & "Phone: " & varPhone & ""_
& VBCrLf & VBCrLf & "Email: " & varEmail & ""_
& VBCrLf & VBCrLf & "Query: " & varQuery & ""

objMail.Send

Set objMail = Nothing

Response.Redirect(varRedirect)

%>


Thanks.

shaunacg
 
The most common problem with CDONTS is generally that IIS dosn't have default SMTP settings set. If you go to the Internet Services Manager (Administrative Tools), Right click on your web server, select properties, go to the Server Extensions Tab, look for the middle "Options" panel, click the "Settings.." button, you will get a popup that will allow you to configure the default options. The other solution is to do this in Outlook Express (possibly Outlook as well). The CDONTS object can queue up mail but needs to have an SMTP server to send through.

The next problem, and one that I have had personally, is that many SMTP servers will not allow you to send mail through them unless your address belongs to that server.

I have also had a problem where I couldn't get CDONTS to send an email at all, it would just disappear. I never reolved this and ended up moving to CDOSYS (available on windows 2000 and greater) which for some reason would work perfectly ok with the same exact setings as CDONTS. It would also be a good idea to move to CDOSYS simply because CDONTS was for NT systems, it was only included on 2000 to give people more time to move to CDOSYS (when using to create object, actually called CDO). CDOSYS is a little moe complicated but allows a much greater range of funcitonality and options. CDONTS is not supported on windows XP so starting a new site dependant on it now will quickly become an issue if you plan on upgrading that server anytime soon.

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
look in your inetpub\mailroot\badmail directory. Are the mails ending up there?

Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Hi,

Thanks, I'll look into all those things now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top