email response help

fasedor

New Member
GREETINGS PEOPLE :)

I would like to use one asp script but i'm just not familiar with programing so
any help would be nice.

The scenario is next:

When some visitor come to my form.html page he/she needs to submit his/her
name and e-mail address and then click submit button to be redirected to say
thankyou.html.

Now i would like to email the user instantly when he/she submit the form ( he basically get automatic response ) with
e-mail message like " Thank you for submiting those infos ".

I just don't know the code for that and please provide me with some examples.

After all i would like to check that script in iis 5.1 with SMTP server on win xp to be sure that everything work if it's possible.

So THANK YOU guy's for all. :)
 

zkiller

Super Moderator
Staff member
what mail components does your host support? asp doesn't have a build in mail module. for this it uses components. most popular are persists aspmail and aspsmartmail from a company called aspsmart.

based on what components your host supports, you will need to write the code. it's very simple and i'd be happy to help once you know what component you have to go with.
 

fasedor

New Member
Thank's for reply :)

The component would be CDOSYS component.

I hope i'm clear about what i wish to accomplish.
Again when user submit his e-mail address in that field like:
([email protected]) and click on submit button he get instant response to that submitted address ([email protected])
with those " thank you " message.

So please help if you or anybody can.

Thank's again :)
 

zkiller

Super Moderator
Staff member
here is a decent tutorial explaining how to use the CDOSYS object.

http://hosting.fast-trak.net/tutorials/cdosys_asp_tutorial.htm

to automatically insert the email address the user submitted you do something like this...

1. i am gonna assume the email address field in the html form is called "email_address"

Code:
<%@ Language="VBSCRIPT" %>

<%
' declaring a variable

dim user_email_address

' setting the variable equal to the user submitted value

user_email_address = Request.Form("email_address")
now in below this bit of code you would put the code for the CDOSYS object as shown in the tutorial. this should look something like...

Code:
Dim MyMail
Set MyMail = Server.CreateObject("CDO.Message")
MyMail.From = "[email protected]"
MyMail.To = user_email_address
MyMail.Subject = "Thank you from YourDomain.com"
MyMail.TextBody = "Thank you for your participation... bla bla bla " &_
                          "bla bla bla"

MyMail.Fields("urn:schemas:httpmail:importance").Value = 2;
MyMail.Fields("http://schemas.microsoft.com/cdo/conf iguration/smtpserver") = "your smtp server"

' if your smtp server requires authentication add the following three lines

MyMail.Fields("http://schemas.microsoft.com/cdo/conf iguration/smtpauthenticate") = 1
MyMail.Fields("http://schemas.microsoft.com/cdo/conf iguration/sendusername") = "account name"
MyMail.Fields("http://schemas.microsoft.com/cdo/conf iguration/sendpassword") = "account password"

MyMail.Fields("http://schemas.microsoft.com/cdo/conf iguration/smtpserverport") = 25
MyMail.Fields.Update()
MyMail.Send()
Set MyMail = Nothing
and finally to redirect the user to your thank you page, unless you want them to see a blank page that is :p

Code:
Response.Redirect("thank_you_page.htm")
%>
hope that works for ya... let me know if you have any questions.
 

zkiller

Super Moderator
Staff member
one thing i forgot to mention...

put the above mentioned code into a seperate file and i am just gonna assume you will call it "mail.asp".

in your html form you will need to set this file as the action, so when the form is submitted, it calls the asp file before redirecting the user to the thank you page.
 

fasedor

New Member
Thank's for your effort to help :)

I tested the code with iis 5.1 and smtp virtual server to be sure that everything is working.

The result:

The code seems to be ok , but when i want to send the message with that smtp server the message stay in queue folder never leaving out .

I'm not sure that the settings in that server are corect.

What i did is:

I was the anonymous user who submited email address on that html page with one correct one like ( [email protected] - that is my valid address on remote isp on internet, and i'm not connected to internet through them while
testing this stuff)
At the end the thank you messagge as i said never leaved out the queue folder and never come to my [email protected] address.

So what the hell is the problem.
I suppose the settings are not corect in smtp server, if you could please help me anyway i would be very grateful.

Thank's again :)
 
Last edited:
Top