OutFront Forums
     Home    Register     Search      Help      Login    

Follow Us
On Facebook
On Twitter
RSS
Via Email

Recent Posts
Todays Posts
Most Active posts
Posts since last visit
My Recent Posts
Mark posts read

Sponsors
Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.
Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.
Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

 

aspMail with a front page form

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP, PHP, and Database >> aspMail with a front page form
Page: [1]
 
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
aspMail with a front page form - 9/6/2008 17:31:25   
I have a FP form which posts into to an Access DB. Below the form code I have aspMail code that sends a confirmation e-mail back to the user. Things work fine except that I would like to use information from the form fields in the confirmation e-mail. For example, I want the confirmation e-mail to start “Dear John” - John being in the firstname field of the form.

The line of aspmail code I am using is:
Mailer.BodyText = "Dear " & Request.form("firstname")

The e-mail is sent, but “john” does not appear in the e-mail.
The form is a standard Front Page 2003 form. The form tag is <form method="POST" action="--WEBBOT-SELF--">

Can anyone help?
pd_it_guy

 

Posts: 215
Joined: 3/4/2008
Status: offline

 
RE: aspMail with a front page form - 9/6/2008 17:43:54   
Are you using any sort of confirmation page?

(in reply to stu)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/6/2008 17:58:16   
For the time being, I'm just using the standard fp confirmation

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 215
Joined: 3/4/2008
Status: offline

 
RE: aspMail with a front page form - 9/6/2008 18:10:24   
Here's a thread as I went through the exact same problem.

http://www.frontpagewebmaster.com/m-383167/tm.htm#383167

I was advised to put the mail routine on the same page as the database write, but having no luck recovering variables there, it ended up on the confirm page. I like to use a confirm page so people know what they have just sent, and the default one is not too good looking. And as I point out there is a lot less clutter on the confirm page for your mail routine. fp_saved_fields("fieldname") I believe recovers all variables.

The other option is with slimmed down code and no bots. Then it gets really simple but lets not make this any more complicated than it needs to be for now.

(in reply to stu)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/8/2008 22:07:36   
pd_it_guy,

Thanks for your input. I looked around for the confirmation page code without much success. The closest I came was the fpdbform.inc file in the _fpclass folder. I tried noodling around with the code in that file without much luck.
Can you be more specific in how to use aspMail in a frontpage confirmation page so that it will recover variables?

(in reply to pd_it_guy)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/8/2008 22:36:47   

On your confirmation page, use FP_SavedFields("firstname") to capture the value.

Take a look at this thread
http://www.frontpagewebmaster.com/m-376690/tm.htm#376918

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
pd_it_guy

 

Posts: 215
Joined: 3/4/2008
Status: offline

 
RE: aspMail with a front page form - 9/9/2008 10:28:09   
stu

There shouldn't be anything you should have to change in the include files, in the _fpclass folder. FP tends to make those up as needed, more or less automatically, and are not normally edited.

Is your mail routine now moved to the confirmation page?

Is the issue recovering variables or gatting the mail to work?

If you use the wizard to call a confirmation page to your form, fp_SavedFields("fieldname") will call them back even if you don't present them back to the poster.

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/9/2008 20:46:26   
Post your code, its faster to fix your problem if we can see how you are not doing it correctly.

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to pd_it_guy)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/10/2008 11:18:40   
Here's the aspMail code that sends the email (I've xxx'd out the actual email addresses). It works as far as sending the email but doesn't pick up the form values.
I've tried it at the bottom of a fp form that posts to a db and on a confirmation page. I did not yet fool with the fp_SavedFields("fieldname") snipit. Where in my code would that be placed?




<%


Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "The Buckingham Auto Show Concours D'elegance"
Mailer.FromAddress= "raffle@buckinghamautoshow.org"
Mailer.RemoteHost = "mail4.webexpert.net"
Mailer.AddRecipient "Raffle Ticket Buyer", Request.form("email")
Mailer.AddCC "Buckingham Auto Show", "xxx.org"
Mailer.AddCC "Buckingham Auto Show", "xxxx.net"
Mailer.Subject = "Raffle Ticket Purchase Confirmation"
Mailer.BodyText = "Dear " & Request.form("firstname") & " " & Request.form("lastname")
Mailer.BodyText = " "
Mailer.BodyText = " This e-mail confirms your on-line purchase of raffle tickets for the 1957 Ford Thunderbird in connection with the Buckingham Auto Show Concours d'Elegance. The below listed information will be used for our drawing which is scheduled to take place on Sept 14, 2008. It is not necessary for you to be present at the show to win. Check our web site at www.buckinghamautoshow.org for updates.-----Good Luck!"
Mailer.BodyText = " "
Mailer.BodyText = "Name: " & Request.form("firstname") & " " & Request.form("lastname")& vbcrlf & "Address: " & Request.form("address") & vbcrlf & "City: " & Request.form("city") & vbcrlf & "State: " & Request.form("state")& vbcrlf & "zip: " & Request.form("zip") & vbcrlf & "Phone: " & Request.form("phone") & vbcrlf & "Email: " & Request.form("email")



if Mailer.SendMail then
Response.Write "Confirming E-Mail sent"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/10/2008 11:24:26   

Try substitute
Request.Form("firstname") with FP_SavedFields("firstname")
Request.Form("lastname") with FP_SavedFields("lastname")

etc
etc
etc
...and so forth.

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/10/2008 13:23:48   
William,
No joy.
The error msg is "Type mismatch: 'FP_SavedFields' "

In this scenario, I used a fp form to post to the db (which successfully happened) and used a separate asp page as the confirmation page, where the aspMail code resides.

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/10/2008 18:14:09   

So the form posts ok to the db and the error appears on the confirmation asp page?

I hope you don't mind posting the code on the asp confirmation page, those after you had replaced Request.Form with FP_SavedFields.

< Message edited by William Lee -- 9/10/2008 21:30:39 >


_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/10/2008 20:52:32   
And also post the URL to your form or, better, if you could mock-up identical pages on a test subweb and post the link to that test site.

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to William Lee)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/10/2008 22:35:29   
I have set up some test pages on the server as follows;

The url to the form is http://www.buckinghamautoshow.org/0Testform.asp
This posts to the data base and works fine.

The url to the confirmation page is http://www.buckinghamautoshow.org/0TestConfirmation.asp
If you go directly to the confirmation page, you will see the error msg re FP_SavedFields.

If you fill in the form; the confirmation page with the aspMail code will send you an e-mail, but will not capture the form values.

The data base drw url is http://www.buckinghamautoshow.org/0Testdrw.asp

The relevant aspMail code on the confirmation page is as follows:

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "The Buckingham Auto Show Concours D'elegance"
Mailer.FromAddress= "raffle@buckinghamautoshow.org"
Mailer.RemoteHost = "mail4.webexpert.net"
Mailer.AddRecipient "Raffle Ticket Buyer", Request.form("email")
Mailer.AddCC "Buckingham Auto Show", "sabramson6@comcast.net"
Mailer.Subject = "Raffle Ticket Purchase Confirmation"

Mailer.BodyText = "Dear " & FP_SavedFields("firstname")
& " " & FP_SavedFields("lastname")


(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/10/2008 22:41:44   

quote:

ORIGINAL: stu


The relevant aspMail code on the confirmation page is as follows:

Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "The Buckingham Auto Show Concours D'elegance"
Mailer.FromAddress= "raffle@buckinghamautoshow.org"
Mailer.RemoteHost = "mail4.webexpert.net"
Mailer.AddRecipient "Raffle Ticket Buyer", Request.form("email")
Mailer.AddCC "Buckingham Auto Show", "sabramson6@comcast.net"
Mailer.Subject = "Raffle Ticket Purchase Confirmation"

Mailer.BodyText = "Dear " & FP_SavedFields("firstname")
& " " & FP_SavedFields("lastname")




The error msg:
Microsoft VBScript compilation error '800a0400'

Expected statement

/0TestConfirmation.asp, line 22

& " " & FP_SavedFields("lastname")




ok you need to add the Line Continuation underscore character everytime you wrap the lines

Eg like this
Mailer.BodyText = "Dear " & FP_SavedFields("firstname") _
& " " & FP_SavedFields("lastname")



_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/11/2008 12:17:59   
William,
Tried the underscore on the wrapped line, and tried with a continuous line (no wrapping).
Still no joy. Same error message, except now it refers to line 21 since there is no wrapping issue.

Further info: the request.form function worked fine for me before the host changed servers from a win2000 server to a win2003 server. He says there is nothing in the new server that would prevent this from working, but now I have some doubts. Any thoughts?

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/11/2008 18:09:08   

quote:

ORIGINAL: stu

William,
Tried the underscore on the wrapped line, and tried with a continuous line (no wrapping).
Still no joy. Same error message, except now it refers to line 21 since there is no wrapping issue.



I tried the test confirmation page and ....


Thumbnail Image
:)

Attachment (1)

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/11/2008 20:50:29   

quote:

ORIGINAL: William Lee


quote:

ORIGINAL: stu

William,
Tried the underscore on the wrapped line, and tried with a continuous line (no wrapping).
Still no joy. Same error message, except now it refers to line 21 since there is no wrapping issue.



I tried the test confirmation page and ....


Thumbnail Image
:)


Actually I shouldn't be getting the Success msg if I did not go through the form. If I go directly to the 0Testconfirmation.asp, I should be getting an error msg telling me the script is not being passed values to the variables, ie an "Expected" error statement.

If it is not working, kindly post the COMPLETE code from that confirmation page.




_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/11/2008 21:13:57   
quote:

The url to the form is http://www.buckinghamautoshow.org/0Testform.asp


Stu, this is NOT a FP Form. There is no FP Formhandler webbot in the page source.

Your form action is set to post directly to 0TestConfirmation.asp. In this scenario, FP_SavedFields doesn't work.

Why shouldn't Request.Form work for you? It should.

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/12/2008 15:50:59   
Success.

After many hours of noodling around, working with tech support at the host, here's the solution:

Used an htm form that posts to an asp page with fp "insert into" code that posts to the db (previous help from past spooky posts) & the aspMail code.

This is what I was originally using when the host changed servers. I'm hard pressed to explain why it started working again. Maybe the host went back and changed a setting on the server? Maybe my original code got screwed up??

Anyway, thank you for your helpful posts. William, I'm still grateful to you for your Spooky Diet code, which I continue to use.

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/12/2008 23:33:07   
quote:

ORIGINAL: stu

<%


Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "The Buckingham Auto Show Concours D'elegance"
Mailer.FromAddress= "raffle@buckinghamautoshow.org"
Mailer.RemoteHost = "mail4.webexpert.net"
Mailer.AddRecipient "Raffle Ticket Buyer", Request.form("email")
Mailer.AddCC "Buckingham Auto Show", "xxx.org"
Mailer.AddCC "Buckingham Auto Show", "xxxx.net"
Mailer.Subject = "Raffle Ticket Purchase Confirmation"
Mailer.BodyText = "Dear " & Request.form("firstname") & " " & Request.form("lastname")
Mailer.BodyText = " "
Mailer.BodyText = " This e-mail confirms your on-line purchase of raffle tickets for the 1957 Ford Thunderbird in connection with the Buckingham Auto Show Concours d'Elegance. The below listed information will be used for our drawing which is scheduled to take place on Sept 14, 2008. It is not necessary for you to be present at the show to win. Check our web site at www.buckinghamautoshow.org for updates.-----Good Luck!"
Mailer.BodyText = " "
Mailer.BodyText = "Name: " & Request.form("firstname") & " " & Request.form("lastname")& vbcrlf & "Address: " & Request.form("address") & vbcrlf & "City: " & Request.form("city") & vbcrlf & "State: " & Request.form("state")& vbcrlf & "zip: " & Request.form("zip") & vbcrlf & "Phone: " & Request.form("phone") & vbcrlf & "Email: " & Request.form("email")



if Mailer.SendMail then
Response.Write "Confirming E-Mail sent"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>



Glad to hear things are ok now. However, I relook your code above and can't help commenting that Mailer.BodyText keeps getting overwritten and the eventual body text of the email contains only what is shown below and nothing of the preceding lines that you put into Mailer.BodyText

Mailer.BodyText = "Name: " & Request.form("firstname") & " " & Request.form("lastname")& vbcrlf & "Address: " & Request.form("address") & vbcrlf & "City: " & Request.form("city") & vbcrlf & "State: " & Request.form("state")& vbcrlf & "zip: " & Request.form("zip") & vbcrlf & "Phone: " & Request.form("phone") & vbcrlf & "Email: " & Request.form("email")

Everytime you assign new value to Mailer.BodyText, that will replace the previous assigned value.

To retain all the values/content you have previously assigned, you should buffer them as follows using a variable, for example sBodyText:

sBodyText= "Dear " & Request.Form("firstname") & " " & Request.Form("lastname") & vbCrLf
sBodyText= sBodyText & "This e-mail confirms your on-line purchase of raffle ...blah..blah" & vbCrLf


...and so on...and finally putting everything into Mailer.BodyText
Mailer.BodyText = sBodyText & "Name: " & Request.form("firstname") & " " & Request.form("lastname")& vbcrlf & "Address: " & Request.form("address") & vbcrlf & "City: " & Request.form("city") & vbcrlf & "State: " & Request.form("state")& vbcrlf & "zip: " & Request.form("zip") & vbcrlf & "Phone: " & Request.form("phone") & vbcrlf & "Email: " & Request.form("email")

... not forgetting the line continuation underscore character when wrapping lines

See the difference?


< Message edited by William Lee -- 9/13/2008 11:38:39 >


_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
stu

 

Posts: 142
From: doylestown,pa
Status: offline

 
RE: aspMail with a front page form - 9/15/2008 19:45:49   
William,
dunno about your code concerns but below is the code that finally worked. I have a fp form.htm page that posts to an asp page which has some "insert into" code to post to the database and aspMail to send the emails.
I'm not exactly sure why it started working, but at this point, it works and I'm done.


Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "The Buckingham Auto Show Concours D'elegance"
Mailer.FromAddress= "raffle@buckinghamautoshow.org"
Mailer.RemoteHost = "mail4.webexpert.net"
Mailer.AddRecipient "Raffle Ticket Buyer", Request.form("email")
Mailer.AddCC "Buckingham Auto Show", "raffle@buckinghamautoshow.org"
Mailer.AddCC "Buckingham Auto Show", "sabramson6@comcast.net"
Mailer.Subject = "Raffle Ticket Purchase Confirmation"
Mailer.BodyText = "Dear " & Request.form("firstname") & " " & Request.form("lastname")
Mailer.BodyText = " "
Mailer.BodyText = " This e-mail confirms your on-line purchase of raffle tickets for the 1957 Ford Thunderbird in connection with the Buckingham Auto Show Concours d'Elegance. The below listed information will be used for our drawing which is scheduled to take place on Sept 14, 2008. It is not necessary for you to be present at the show to win. Check our web site at www.buckinghamautoshow.org for updates.-----Good Luck!"
Mailer.BodyText = " "
Mailer.BodyText = "Name: " & Request.form("firstname") & " " & Request.form("lastname")& vbcrlf & "Address: " & Request.form("address") & vbcrlf & "City: " & Request.form("city") & vbcrlf & "State: " & Request.form("state")& vbcrlf & "zip: " & Request.form("zip") & vbcrlf & "Phone: " & Request.form("phone") & vbcrlf & "Email: " & Request.form("email")



if Mailer.SendMail then
Response.Write "Confirming E-Mail sent"
else
Response.Write "Mail send failure. Error was " & Mailer.Response
end if
%>

(in reply to William Lee)
William Lee

 

Posts: 1273
Joined: 1/25/2002
From: Singapore
Status: offline

 
RE: aspMail with a front page form - 9/16/2008 7:01:45   
Sorry stu, I was wrong about the mailer.bodytext thingy.:)
It has a ClearBodyText method, which implies that it does 'remember' all assigned values.

_____________________________

William Lee

pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ
nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ





(in reply to stu)
Page:   [1]

All Forums >> Web Development >> ASP, PHP, and Database >> aspMail with a front page form
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts