ASP Script Help - NewMailObj - HotUKDeals
We use cookie files to improve site functionality and personalisation. By continuing to use HUKD, you accept our cookie and privacy policy.
Get the HUKD app free at Google Play

Search Error

An error occurred when searching, please try again!

Login / Sign UpSubmit

ASP Script Help - NewMailObj

rashriaz Avatar
6y, 9m agoPosted 6 years, 9 months ago
im creating an email form which emails the form to 2 email address, but i cant get it working. it works fine when theres only onw email address.

this is my code

NewMailObj.To = request.form("email") & "[email protected]"

anyone know what the correct code is
rashriaz Avatar
6y, 9m agoPosted 6 years, 9 months ago
Options

All Comments

(6) Jump to unreadPost a comment
Comments/page:
#1
posting the whole code would be more helpful, but can't you add another email address in to the last part separated by ';' ?
#2
suchafunkymonkey
posting the whole code would be more helpful, but can't you add another email address in to the last part separated by ';' ?


< %@ Language="VBscript" %>
< % Option Explicit %>



Message Sent



<%
'declare the variables that will receive the values
'receive the values sent from the form and assign them to variables
'note that request.form("name") will receive the value entered into the textfield
'called name, and so with email and message
Dim name, email, message, NewMailObj
name=request.form("name")
email=request.form("email")
message=request.form("message")

'create the mail object and send the details
Set NewMailObj=Server.CreateObject("CDONTS.NewMail")
NewMailObj.From = "[email protected]"
NewMailObj.To = request.form("email") and "[email protected]"
NewMailObj.Subject = "Confirmation Email From Grants"
NewMailObj.Body = "the name you entered was " & name & _
"
the email was " & email & _
"
the message was " & message

'you need to add the following lines FOR the mail to be sent in HTML format
NewMailObj.BodyFormat = 0
NewMailObj.MailFormat = 0
NewMailObj.Send
'Close the email object and free up resources
Set NewMailObj = nothing
Response.write "The email was sent."
%>

#4
You've created a variable called email in which you're placing the result from request.form("email"), but you never use this variable and do the request.form again. Use the email variable and combine it with the extra email address separated by ; as I said before or use newmailobj.cc or newmailobj.bcc and put the extra email in there.
#5
suchafunkymonkey
You've created a variable called email in which you're placing the result from request.form("email"), but you never use this variable and do the request.form again. Use the email variable and combine it with the extra email address separated by ; as I said before or use newmailobj.cc or newmailobj.bcc and put the extra email in there.


^
#6
many thanks

worked a treat with bcc

Post a Comment

You don't need an account to leave a comment. Just enter your email address. We'll keep it private.

...OR log in with your social account

...OR comment using your social account

Thanks for your comment! Keep it up!
We just need to have a quick look and it will be live soon.
The community is happy to hear your opinion! Keep contributing!