Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CDOSYS sending Form Data

Guest
Jul 29, 2007 Jul 29, 2007
I have tried every combination of trying to get form data sent in an email without any luck.

objMail.txtEmail = Request.Form("Email")
or
objMail.txtEmail = Request("Email")

If I take out the form elements I can get the system to send me a hardcoded email

Can ANYONE tell me how to add a form variable into an email using CDOSYS.

I am trying to use this as part of an insert, for members who add thier details to our database I want to be able to send an email to someone to be aware who has just been added.

I rely need an answer to this...I have to get this up and running tomorrow

When answering, can you advise were abouts in the script elements should be placed.

ANY help would be appreciated
TOPICS
Server side applications
844
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 01, 2007 Aug 01, 2007
i have had luck with this email code

place before your insert record coding

<%
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")

'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/smtpserver") ="127.0.0.1"
ObjSendMail.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item (" http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Update

'End remote SMTP server configuration section==
if Request.Form("Submit1") = "Send Form" then

ObjSendMail.To = Request.Form("textfield")
ObjSendMail.CC = "xxxx@jbwebworks.com"
ObjSendMail.BCC = "xxxx@bellsouth.net"
ObjSendMail.Subject = "RE:golf tournament entry form is attached"
ObjSendMail.From = "pco@pcogolf.org"

' we are sending a text email.. simply switch the comments around to send an html email instead
'ObjSendMail.HTMLBody = Request.Form("textfield")
ObjSendMail.TextBody = ObjSendMail.TextBody & cStr(Request.Form("textfield"))
ObjSendMail.TextBody = ObjSendMail.TextBody & "" & vbCrlf & ""
ObjSendMail.TextBody = ObjSendMail.TextBody & "Thank you for entering this years Panhandle Charitable Open"
ObjSendMail.TextBody = ObjSendMail.TextBody & "" & vbCrlf & ""
ObjSendMail.TextBody = ObjSendMail.TextBody & "Entry form is attached"
ObjSendMail.TextBody = ObjSendMail.TextBody & "" & vbCrlf & ""
ObjSendMail.TextBody = ObjSendMail.TextBody & "Please print form, fill out and mail in with your entry fee"
ObjSendMail.TextBody = ObjSendMail.TextBody & "" & vbCrlf & ""
ObjSendMail.TextBody = ObjSendMail.TextBody & "" & vbCrlf & ""
ObjSendMail.AddAttachment Server.MapPath("/entryform.doc")

ObjSendMail.Send

Set ObjSendMail = Nothing

end if
%>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 02, 2007 Aug 02, 2007
Cheers Jim, thanks fort your help with that, I have it working now, however, it is only sending me the last data field ("ContactNumber") in the script. How do I get all the other fields included in the email?



objMail.TextBody = Request.Form("Email")
objMail.TextBody = Request.Form("FirstName")
objMail.TextBody = Request.Form("LastName")
objMail.TextBody = Request.Form("FirstName")
objMail.TextBody = Request.Form("ContactNumber")

Regards
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 02, 2007 Aug 02, 2007
LATEST
try this

objMail.TextBody = objMail.TextBody &cStr(Request.Form("Email"))
objMail.TextBody = objMail.TextBody &cStr(Request.Form("FirstName"))
objMail.TextBody = objMail.TextBody &cStr(Request.Form("LastName"))
objMail.TextBody = objMail.TextBody &cStr(Request.Form("FirstName"))
objMail.TextBody = objMail.TextBody &cStr(Request.Form("ContactNumber"))
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines