i am using an asp script to receive the emails of subscribers.
Do you know of any script that, on receipt of an email automatically sends a reply (a preset html email), including 'Dear Name,' (if the email is name@domain.com) where specified -
maybe with the [NAME] tag?
If for example a user submits his email (hisname@hisdomain.com) to orders@mydomain.com he receives an automated reply (a custom html email) in the form of:
Ok lol, I see hmm... Well I'm only new to asp but I imagine that it would got a little like:
Code:
<html>
<head>
</head>
<body>
<% if request.QueryString("domain") = "apples" then
autoresponse = "apples"
else if request.QueryString("domain") = "oranges" then
autoresponse = "oranges"
dim EmailText
EmailText = "Dear & hisname &"
dim SendEmail
SendEmail = autoresponse
dim EmailFrom
EmailFrom = " & autoresponse & @mydomain.com"
dim myMail
If SendEmail = autoresponse then
Set myMail = CreateObject("CDONTS.NewMail")
myMail.From = EmailFrom
myMail.To = Request.Form("FruitForm")
myMail.Subject = autoresponse
myMail.Body = EmailText
myMail.Send
Set myMail = Nothing
end if
end if
end if %>
</body>
</html>
__________________ Omnis mico antequam dominus Spookster!
<html>
<head>
</head>
<body>
<% if request.QueryString("domain") = "apples" then
autoresponse = "apples"
else if request.QueryString("domain") = "oranges" then
autoresponse = "oranges"
dim EmailText
EmailText = "Dear " & hisname
dim SendEmail
SendEmail = autoresponse
dim EmailFrom
EmailFrom = autoresponse & "@mydomain.com"
dim myMail
If SendEmail = autoresponse then
Set myMail = CreateObject("CDONTS.NewMail")
myMail.From = EmailFrom
myMail.To = Request.Form("FruitForm")
myMail.Subject = autoresponse
myMail.Body = EmailText
myMail.Send
Set myMail = Nothing
end if
end if
end if %>
</body>
</html>
well I feel a little more confused, but I guess it's a very good sign.
On my site a visitor has the option to order each product by simply imputing their email address. Each submit form is run by an asp script I have included at the end of this post.
My question is how can I integrate what you posted with this script, or can I customise the script I am currently using to send an automated email to the submitter?
DHTMLHELP
<%
'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
Response.Buffer = True
'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
'----------------- Place your e-mail address in the following sting ----------------------------------
strMyEmailAddress = "sales@domain.com"
'----------- Place Carbon Copy e-mail address's in the following sting, separated by ; --------------
strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail
'----------- Place Blind Copy e-mail address's in the following sting, separated by ; --------------
strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")
'Initialse strBody string with the body of the e-mail
strBody = "<h2>Test Header</h2>"
strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to your own
strReturnEmailAddress = strMyEmailAddress
End If
'Send the e-mail
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
objCDOMail.From = "<" & strReturnEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress
'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress
'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the subject of the e-mail
objCDOMail.Subject = "Test Title"
'Set the main body of the e-mail
objCDOMail.Body = strBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
'Send the e-mail
objCDOMail.Send
'Close the server object
Set objCDOMail = Nothing
%>
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Test</title>
it does work but it doesn't do everything I would like it to do.
The script I have posted sends me an email with the email address of the person requesting the product and the item desired.
What i would also like the script to do is automatically send a reply to the submitter with details on how to complete the transaction; this without having to setup an autoresponder.
But from what I can see it would go a little like this:
Code:
<%
'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
Response.Buffer = True
'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
Dim strAutoEmailAddress 'Holds e-mail address of the user for Auto Responder
'----------------- Place your e-mail address in the following sting ----------------------------------
strMyEmailAddress = "sales@domain.com"
'----------- Place Carbon Copy e-mail address's in the following sting, separated by ; --------------
strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail
'----------- Place Blind Copy e-mail address's in the following sting, separated by ; --------------
strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail
'-----------------------------------------------------------------------------------------------------
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")
'Initialse strBody string with the body of the e-mail
strBody = "<h2>Test Header</h2>"
strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to your own
strReturnEmailAddress = strMyEmailAddress
End If
'---------------------------------Auto Response Information Added by Mhtml-------------------------
'Set the users e-mail address
strAutoEmailAddress = strReturnEmailAddress
'set auto response body
strAutoBody = "Thank you for you order.<br><font color=(ff0000)>This is an automated response please do not reply to this e-mail</font>"
'----------------------------------------------END AUTO RESPONSE---------------------------------
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
objCDOMail.From = "<" & strReturnEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress
'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress
'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the subject of the e-mail
objCDOMail.Subject = "Test Title"
'Set the main body of the e-mail
objCDOMail.Body = strBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
'Send the e-mail
objCDOMail.Send
'Close the server object
Set objCDOMail = Nothing
'-------------------------------------------------------AUTO RESPONDER ADDED BY Mhtml------------
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
objCDOMail.From = "<" & strMyEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strAutoEmailAddress
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the subject of the e-mail
objCDOMail.Subject = "Auto Response to order submission"
'Set the main body of the e-mail
objCDOMail.Body = strAutoBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
'Send the e-mail
objCDOMail.Send
'Close the server object
Set objCDOMail = Nothing
%>
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Test</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099" alink="#FF0000">
<br>
</body>
</html>
I think this should work.
PS: You can see where I have put in the exrta code, you can remove the added by Mhtml ifyou want, I just put it there so that you can see where I did stuff.
__________________ Omnis mico antequam dominus Spookster!
oh ok, I see the prob. I didn't declare the variable strAutoBody.
I have fixed it.
Code:
<%
'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
Response.Buffer = True
'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objCDOMail 'Holds the mail server object
Dim strMyEmailAddress 'Holds your e-mail address
Dim strCCEmailAddress 'Holds any carbon copy e-mail addresses if you want to send carbon copies of the e-mail
Dim strBCCEmailAddress 'Holds any blind copy e-mail addresses if you wish to send blind copies of the e-mail
Dim strReturnEmailAddress 'Holds the return e-mail address of the user
Dim strAutoEmailAddress 'Holds e-mail address of the user for Auto Responder
Dim strAutoBody 'Body for Auto Response
'----------------- Place your e-mail address in the following sting ----------------------------------
strMyEmailAddress = "sales@domain.com"
'----------- Place Carbon Copy e-mail address's in the following sting, separated by ; --------------
strCCEmailAddress = "" 'Use this string only if you want to send the carbon copies of the e-mail
'----------- Place Blind Copy e-mail address's in the following sting, separated by ; --------------
strBCCEmailAddress = "" 'Use this string only if you want to send the blind copies of the e-mail
'-----------------------------------------------------------------------------------------------------
'Read in the users e-mail address
strReturnEmailAddress = Request.Form("email")
'Initialse strBody string with the body of the e-mail
strBody = "<h2>Test Header</h2>"
strBody = strBody & "<br><b>E-mail: </b>" & strReturnEmailAddress
'Check to see if the user has entered an e-mail address and that it is a valid address otherwise set the e-mail address to your own otherwise the e-mail will be rejected
If Len(strReturnEmailAddress) < 5 OR NOT Instr(1, strReturnEmailAddress, " ") = 0 OR InStr(1, strReturnEmailAddress, "@", 1) < 2 OR InStrRev(strReturnEmailAddress, ".") < InStr(1, strReturnEmailAddress, "@", 1) Then
'Set the return e-mail address to your own
strReturnEmailAddress = strMyEmailAddress
End If
'---------------------------------Auto Response Information Added by Mhtml-------------------------
'Set the users e-mail address
strAutoEmailAddress = strReturnEmailAddress
'set auto response body
strAutoBody = "Thank you for you order.<br><font color=(ff0000)>This is an automated response please do not reply to this e-mail</font>"
'----------------------------------------------END AUTO RESPONSE---------------------------------
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
objCDOMail.From = "<" & strReturnEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strMyEmailAddress
'Who the carbon copies are sent to
objCDOMail.Cc = strCCEmailAddress
'Who the blind copies are sent to
objCDOMail.Bcc = strBCCEmailAddress
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the subject of the e-mail
objCDOMail.Subject = "Test Title"
'Set the main body of the e-mail
objCDOMail.Body = strBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
'Send the e-mail
objCDOMail.Send
'Close the server object
Set objCDOMail = Nothing
'-------------------------------------------------------AUTO RESPONDER ADDED BY Mhtml------------
'Create the e-mail server object
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
'Who the e-mail is from (this needs to have an e-mail address in it for the e-mail to be sent)
objCDOMail.From = "<" & strMyEmailAddress & ">"
'Who the e-mail is sent to
objCDOMail.To = strAutoEmailAddress
'Set the e-mail body format (0=HTML 1=Text)
objCDOMail.BodyFormat = 0
'Set the subject of the e-mail
objCDOMail.Subject = "Auto Response to order submission"
'Set the main body of the e-mail
objCDOMail.Body = strAutoBody
'Importance of the e-mail (0=Low, 1=Normal, 2=High)
objCDOMail.Importance = 1
'Send the e-mail
objCDOMail.Send
'Close the server object
Set objCDOMail = Nothing
%>
<html>
<head>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title>Test</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990099" alink="#FF0000">
<br>
</body>
</html>
__________________ Omnis mico antequam dominus Spookster!