Delfin Lazaro
07-23-2004, 12:52 AM
Hello,
Im trying to use Cdonts to send email from a server hosted at godaddy.com.
I am able to send one email, but when I try to send a second email, it doesnt work. Basically, when someone fills out the form, they give me their email address. After they submit the form, I want to send two emails: one to myself and one back to the person saying his email was received (using the email he provided). When I only send one email, it works fine. But when I add the code to send a second email, it doesnt work.
The way Im trying to do it is by creating two mail objects and sending them separately. Is this a correct way to send two emails using the same asp file?
Here is my asp code. (The html form code is basic so I didnt include it - you can assume the email given is valid)
Any help would be great. thanks!
Delfin
---------------------------------------
<html>
<body>
<% dim email
email=Request.Form("email")
%>
<%
' Create first mail object
Dim MyMail
Set MyMail = Server.CreateObject("CDONTS.NewMail")
' Set parameters
If IsObject(MyMail) Then
MyMail.From = "d_lazaro@hotmail.com"
MyMail.To = "d_lazaro@hotmail.com"
MyMail.Subject = "Testing mail script"
MyMail.BodyFormat = 0
MyMail.MailFormat = 1
MyMail.Importance = 2
MyMail.Body = "This is a test."
MyMail.Send
Set MyMail = Nothing
Response.write("message sent")
Else
Response.write("message not sent")
End If
'The second mail object
Dim AutoReply
Set AutoReply = Server.CreateObject("CDONTS.NewMail")
'Set parameters
If IsObject(AutoReply) Then
AutoReply.From = "d_lazaro@hotmail.com"
AutoReply.To = email
AutoReply.Subject = "Email Confirmation"
AutoReply.BodyFormat = 0
AutoReply.MailFormat = 1
AutoReply.Importance = 2
AutoReply.Body = "Your Email has been received. "
AutoReply.Send
Set AutoReply = Nothing
Response.write("second message sent")
Else
Response.write("An error has occurred. Response not sent")
End If
%>
Im trying to use Cdonts to send email from a server hosted at godaddy.com.
I am able to send one email, but when I try to send a second email, it doesnt work. Basically, when someone fills out the form, they give me their email address. After they submit the form, I want to send two emails: one to myself and one back to the person saying his email was received (using the email he provided). When I only send one email, it works fine. But when I add the code to send a second email, it doesnt work.
The way Im trying to do it is by creating two mail objects and sending them separately. Is this a correct way to send two emails using the same asp file?
Here is my asp code. (The html form code is basic so I didnt include it - you can assume the email given is valid)
Any help would be great. thanks!
Delfin
---------------------------------------
<html>
<body>
<% dim email
email=Request.Form("email")
%>
<%
' Create first mail object
Dim MyMail
Set MyMail = Server.CreateObject("CDONTS.NewMail")
' Set parameters
If IsObject(MyMail) Then
MyMail.From = "d_lazaro@hotmail.com"
MyMail.To = "d_lazaro@hotmail.com"
MyMail.Subject = "Testing mail script"
MyMail.BodyFormat = 0
MyMail.MailFormat = 1
MyMail.Importance = 2
MyMail.Body = "This is a test."
MyMail.Send
Set MyMail = Nothing
Response.write("message sent")
Else
Response.write("message not sent")
End If
'The second mail object
Dim AutoReply
Set AutoReply = Server.CreateObject("CDONTS.NewMail")
'Set parameters
If IsObject(AutoReply) Then
AutoReply.From = "d_lazaro@hotmail.com"
AutoReply.To = email
AutoReply.Subject = "Email Confirmation"
AutoReply.BodyFormat = 0
AutoReply.MailFormat = 1
AutoReply.Importance = 2
AutoReply.Body = "Your Email has been received. "
AutoReply.Send
Set AutoReply = Nothing
Response.write("second message sent")
Else
Response.write("An error has occurred. Response not sent")
End If
%>