Author |
Topic |
wii
Free ASP Hosts Moderator
Denmark
2632 Posts |
Posted - 11 May 2005 : 08:16:56
|
Does anyone have or know where to find an ASP code for a simple mailform, which has the feature to autoreply the sender ?
Thanks a lot. |
|
Podge
Support Moderator
Ireland
3775 Posts |
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 11 May 2005 : 08:55:33
|
I've good one here somewhere that runs a check for a valid email address too. I'll try and dig it out. |
|
|
wii
Free ASP Hosts Moderator
Denmark
2632 Posts |
Posted - 11 May 2005 : 09:05:30
|
Yeah, I need both:
1. Set the reply to sender adresse. 2. Automatically send a thank you mail to the sender.
I need the entire code please, I can hardly write response.write correctly. |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
wii
Free ASP Hosts Moderator
Denmark
2632 Posts |
Posted - 11 May 2005 : 09:11:15
|
I did, but it doesn´t seem to support automatic thank you mail. |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
pdrg
Support Moderator
United Kingdom
2897 Posts |
Posted - 11 May 2005 : 09:19:33
|
Ahhhh - in that case what you're trying to do is something pretty different - you need to watch a mailbox (pop3, probably, for INCOMING emails) and send a response on arrival of an email. ASP is a technology to run scripts when a WEB PAGE is requested, and sends an email with SMTP (outgoing emails)
You need a service running to poll the mailbox and send the thankyou emails when it finds incoming email. |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 11 May 2005 : 09:27:56
|
Ay, I've done something similar on ocassion, it shouldn't be too difficult to add it to the PD9 script.
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
wii
Free ASP Hosts Moderator
Denmark
2632 Posts |
Posted - 11 May 2005 : 10:14:07
|
I was looking at the code for PD9 script, and it seems very extensive compared to the simple script I use now, would it be possible to add the 2 features to this? Most important would be "1. Set the reply to sender adress."
<% smtp_server_address = "websmtp.XXX" on error resume next Response.Buffer = True Set Jmail = Server.CreateOBject( "JMail.Message" ) Jmail.Logging = true Jmail.Silent = true JMail.From = "from@mail.dk" Jmail.AddRecipient "to@mail.dk" JMail.Subject = "Message from this site" FOR EACH el IN Request.Form body = body & el & ": " & Request.form(el) & vbcrlf NEXT JMail.Body = Body JMail.Priority = 1 if not Jmail.Send(smtp_server_address) then ' There was an error - print the error log Response.write ("Error:<br>" & Jmail.log) else ' The message has been sent - redirect to confirmation page Set JMail = Nothing response.redirect "redirect.asp" end if Set JMail = Nothing %> |
|
|
MarcelG
Retired Support Moderator
Netherlands
2625 Posts |
Posted - 11 May 2005 : 10:37:25
|
For the ReplyTo part, you can just add a line: JMail.ReplyTo = "replyto@address" More tips for JMail: http://www.webmage.com/support/jmail.asp#ReplyTo
If you want to automatically sent the 'thank you' mail, I'd put it in there right after sending the first mail, e.g. something like this:
<%
' Sending the email
JMail.Sender = "wii@mail.dk"
JMail.Subject = "Thank you!"
' Get the recipients mailbox from a form (note the lack of a equal sign).
JMail.AddRecipient Request.Form("from")
JMail.Body = "Thank you for sending your e-mail"
' Send it...
JMail.Execute
%> If I'm not mistaking this should work quite allright. I haven't got the JMail component available here, so I cannot try it. |
portfolio - linkshrinker - oxle - twitter |
|
|
wii
Free ASP Hosts Moderator
Denmark
2632 Posts |
Posted - 12 May 2005 : 06:41:11
|
JMail.ReplyTo = "replyto@address"
But it needs to take the email adress from the form ?
I´ve tried the thank you mail code, but it didn´t work.
Help is appreciated, I wouldn´t even pay someone to do this for me, as a client of mine needs this.
Thanks a lot. |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
|
wii
Free ASP Hosts Moderator
Denmark
2632 Posts |
Posted - 12 May 2005 : 09:37:51
|
Nope sorry, check the mailform itself here (very simple, as I like it)
<FORM action=SendMail.asp method=post> <P><STRONG><LABEL for=name>Name<BR></LABEL></STRONG><INPUT id=name maxLength=200 size=35 name=name> </P> <P><LABEL for=email><STRONG>Email</STRONG><BR></LABEL><INPUT id=email maxLength=100 size=35 name=email></P> <P><STRONG>Message<BR></STRONG><TEXTAREA id=msg name=msg rows=10 cols=35></TEXTAREA> </P> <P><INPUT type=submit value="Send"></P></FORM> |
|
|
Podge
Support Moderator
Ireland
3775 Posts |
Posted - 12 May 2005 : 11:24:18
|
This part of aspformmail.asp takes the form field and sets it to a variable and checks the validity of the email address.
CheckEmail(Request("FromEmail")) strFromEmail = Request("FromEmail")
If you use Request("FromEmail") as the reply to address and bypass the validity check the mail may not get sent or you may not be able to reply to it as it may be invalid.
You obviously need a form field called FromEmail in the form for this to work. |
Podge.
The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)
My Mods: CAPTCHA Mod | GateKeeper Mod Tutorial: Enable subscriptions on your board
Warning: The post above or below may contain nuts. |
Edited by - Podge on 12 May 2005 11:25:33 |
|
|
Topic |
|