Home All Groups Group Topic Archive Search About

Help w/ syntax to have body of email include form fields



Author
22 Mar 2006 12:16 AM
JNariss@gmail.com
Hello,

I finally figured out how to get my form to its database and have an
email come my way. However I am now trying to set up the body of the
email to include the form details. However the body of the email that
is sent only includes the last line of the "body" tag and has no
details next to it.

The email sent shows up with this in its body:

Request Date:


AND NOTHING ELSE.


The script/code I am using is:

<%
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "New Form"
objMessage.Sender = "Intranet"
objMessage.To = "justine.nar***@egseg.com"
objMessage.TextBody="An IT Employee Status Change form has been filled
out. Please see the information below: " & VbCrLf
objMessage.TextBody="Employee Name: " & Request.Form("EmployeeName") &
VbCrLf
objMessage.TextBody="Pay Number: " & Request.Form("PayNumber") & VbCrLF

objMessage.TextBody="Requested By: " & Request.Form("RequestedBy") &
VbCrLF
objMessage.TextBody="Request Date: " & Request.Form("RequestDate")


objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")

= 2
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")

= "155.116.12.19"
objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")

= 25
objMessage.Configuration.Fields.Update


objMessage.Send
%>

I am trying to get the body of the email to look like this:

An IT Employee Status Change form has been filled out. Please see the
information below:

Employee Name: Someones Name
Pay Number: XX333
Requested By: Someones Name
Request Date: mm/dd/yy


All the above fields are the fields to my form that users will be
filling out.

Any help would be greatly appreciated.

Thanks,
Justine

Author
22 Mar 2006 3:19 AM
Ray Costanzo [MVP]
This is happening because every time you are assigning a value to the
..TextBody property of your mail object, it's overwriting the previous value.
It's like doing:

Dim x
x = "a"
x = "b"
x = "c"
x = "d"
Response.Write x

What will you get?  abcd or d?  The answer is d.

Try:

Dim sBody

sBody = = "An IT Employee Status Change form has been filled out. Please see
the information below: " & VbCrLf
sBody = sBody & "Employee Name: " & Request.Form("EmployeeName") & VbCrLf
sBody = sBody & "Pay Number: " & Request.Form("PayNumber") & VbCrLF
sBody = sBody & "Requested By: " & Request.Form("RequestedBy") & VbCrLF
sBody = sBody & "Request Date: " & Request.Form("RequestDate")

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "New Form"
objMessage.Sender = "Intranet"
objMessage.To = "justine.nar***@egseg.com"
objMessage.Textbody = sBody
''etc.

Ray at home



<JNar***@gmail.com> wrote in message
Show quote
news:1142986609.635677.262710@g10g2000cwb.googlegroups.com...
> Hello,
>
> I finally figured out how to get my form to its database and have an
> email come my way. However I am now trying to set up the body of the
> email to include the form details. However the body of the email that
> is sent only includes the last line of the "body" tag and has no
> details next to it.
>
> The email sent shows up with this in its body:
>
> Request Date:
>
>
Author
22 Mar 2006 9:49 AM
JNariss@gmail.com
This is exactly what I needed and I thanks for the reasoning behind it,
too. I will try it out and see what happens.

- Justine

AddThis Social Bookmark Button