|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBScript - Email - CDO Script
I have been messing around with a form page I have on my site. My server requires CDO.Message to email. So I have finally got the script on the page to email when the submit button is pressed, however the email is in source view. Also it is not displaying the thank you page afterwords, all I get is an error code, but I have confirmed the email goes through. What should I do upload the sample page script?
|
|
#2
|
||||
|
||||
|
Yes post your script, and what language are you using?
__________________
Hope this advice helps.
If so please show your appreciation by adding reputation points (click gauge image on top right of this post).- Post your code - Post your errors - Be clear - Be courteous - AND PLEASE...Finalise your thread with a solution or confirmation that the last advice worked or failed. Visit My ASP Free Members Club Profile |
|
#3
|
|||
|
|||
|
i AM USING ASP
Code:
<!--#include virtual="/inc/topBar.html"-->
<div id="main">
<div id="content">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="colLeft"> </td>
<td valign="top">
<h2>Reserving the Venue </h2>
<%if request("action")="SendEmail" then
Set myEmail = Server.CreateObject("CDO.Message")
With myEmail.Configuration.Fields
.Item(schemasURL & "sendusing") = 2
.Item(schemasURL & "smtpserver") = "localhost"
.Item(schemasURL & "smtpconnectiontimeout") = 10
.Item(schemasURL & "smtpserverport") = 25
.Item (schemasURL & "smtpusessl") = False
.Item (schemasURL & "smtpconnectiontimeout") = 60
.Update
End With
myEmail.From = "Request"
myEmail.To = "XXXXXX"
myEmail.CC = "XXXXXX"
myEmail.Subject = "Crevier Classic Cars Event Request"
'**************************************
'get email body for admin
'*************************************
strFileName = Server.MapPath("email_eventRequest.html")
set filesys = CreateObject ("Scripting.FileSystemObject")
set file = filesys.GetFile(strFileName)
set txtstream = file.OpenAsTextStream (1, -2)
mailBody = txtstream.ReadAll
txtstream.Close
set txtstream = nothing
set file = nothing
set filesys = nothing
mailBody = Replace(mailBody, "{name}",request("name"))
mailBody = Replace(mailBody, "{month}",request("month"))
mailBody = Replace(mailBody, "{day}",request("day"))
mailBody = Replace(mailBody, "{year}",request("year"))
mailBody = Replace(mailBody, "{guests}",request("guests"))
mailBody = Replace(mailBody, "{phone}",request("phone"))
mailBody = Replace(mailBody, "{email}",request("email"))
myEmail.TextBody = mailBody
myEmail.Send
Set myEmail = Nothing
Dim objEmail
Set objEmail = Server.CreateObject("Persits.MailSender")
objEmail.Username = "iXXXXXXXXX"
objEmail.Password = "iXXXXX"
objEmail.Host = "XXXXX"
objEmail.From = request("email")
objEmail.AddAddress "XXXXXXXX"
objEmail.AddCC "XXXXXXX"
'objEmail.AddBCC("XXXXXX")
objEmail.Subject = "Crevier Classic Cars Event Request"
'**************************************
'get email body for admin
'*************************************
strFileName = Server.MapPath("email_eventRequest.html")
set filesys = CreateObject ("Scripting.FileSystemObject")
set file = filesys.GetFile(strFileName)
set txtstream = file.OpenAsTextStream (1, -2)
mailBody = txtstream.ReadAll
txtstream.Close
set txtstream = nothing
set file = nothing
set filesys = nothing
mailBody = Replace(mailBody, "{name}",request("name"))
mailBody = Replace(mailBody, "{month}",request("month"))
mailBody = Replace(mailBody, "{day}",request("day"))
mailBody = Replace(mailBody, "{year}",request("year"))
mailBody = Replace(mailBody, "{guests}",request("guests"))
mailBody = Replace(mailBody, "{phone}",request("phone"))
mailBody = Replace(mailBody, "{email}",request("email"))
objEmail.Body = mailBody
objEmail.IsHTML = true
objEmail.Send
Set objEmail = Nothing
%>
Last edited by icoombs : September 15th, 2008 at 07:39 PM. Reason: Added code tags, please use code tags when posting code. |
|
#4
|
||||
|
||||
|
You could try...
Code:
myEmail.HTMLBody = mailBody as it looks like you are trying to send HTML formatted content. |
|
#5
|
|||
|
|||
|
Great thanks so much.
however when I submit I get this error on the thank you page. Reserving the Venue error '800401f3' /reserve.asp, line 93 |
|
#6
|
||||
|
||||
|
Which is line 93?
|
|
#7
|
|||
|
|||
|
Set objEmail = Server.CreateObject("Persits.MailSender")
which is the old mailsender. |
|
#8
|
||||
|
||||
|
It's possible the Persist.Mailer is not installed, I would just change it to...
Code:
Set objEmail = Server.CreateObject("CDO.Message")
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > VBScript - Email - CDO Script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|