Cdont's script

S

Shona

Hi

I have the following script on my confirmation page. It all works fine and
when I receive a mail it says it From what ever has been typed in the field
Name. However what I would also like it to put is the persons surname as
well with a space in between.


<%
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.To = "(e-mail address removed)"
objCDOMail.From = FP_SavedFields("Name")
objCDOMail.Subject = FP_SavedFields("Results")
strBody = strBody & "Name: " & FP_SavedFields("Name") & VbCrLf
strBody = strBody & "Surname: " & FP_SavedFields("Surname") & VbCrLf
objCDOMail.Body = strBody
objCDOMail.BodyFormat = 1
objCDOMail.MailFormat = 1
objCDOMail.Send
Set objCDOMail = Nothing
%>

Hope someone has the answer for me.

Cheers Shona
 
J

Jon Spivey

Hi Shona,

The syntax would be
objCDOMail.From = "Jon Spivey <[email protected]>"
so you'd probably have something like
objCDOMail.From = FP_SavedFields("Name") & " " & FP_SavedFields("LastName")
& " <" & FP_SavedFields("LastName") & ">"

Although you might want to move away from CDONTS as it's no longer
supported, so when you upgrade to xp pro and/or your host upgrades to
windows server 2003 your code will no longer run. So you might want to take
this oppurtunity to migrate your code over to cdo, see this article
http://www.aspfaq.com/show.asp?id=2026
 
S

Shona

Thanks for that modified it slightly and it works

objCDOMail.From = FP_SavedFields("Name") & " " & FP_SavedFields("Surname") &
" <" & FP_SavedFields("Name") & FP_SavedFields("Surname") & ">"

Will certainly look at the cdo if I'm going to run into problems later on.

Thanks again

Shona

news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top