Click to See Complete Forum and Search --> : Email.....help...


ruurlostraat
01-11-2006, 05:57 PM
Hello everybody,
i want to make a web page containing Text Field for users to type in their name, commment... and press the button "Submit". And that session will send a file to the administrator (assumed me)
My question is: in the <form> command, i put action="default.asp", so the file default.asp will handle the session above. If somebody know how to code the asp file, I really appriciate.
Thanks.

chrismartz
01-11-2006, 06:12 PM
Do you want a file sent to you or an email?

If you want an email, I suggest you setup ASPEmail for the email function. Then use the documentation on their site to implement the code.

ruurlostraat
01-11-2006, 06:15 PM
Sorry because I did not make it clear. The web page containing Text Field filled by the user is simple so I can make it. I only need the ASP file.

alon
01-12-2006, 07:18 PM
<%Set myMail=CreateObject("CDO.Message")
myMail.Subject="BLA BLA BLA"
myMail.From="a@a.a"
myMail.To="b@b.com"
myMail.Cc="c@c.com"
myMail.TextBody = "BLA BLA BLA"

myMail.Send
set myMail=nothing
%>

chrismartz
01-12-2006, 07:25 PM
For Alons' email script to work, you need to make sure that cdo is working on your server.

ruurlostraat
01-15-2006, 02:52 PM
Thanks chrismartz and alon,
I'm newbie so I dont know how to make CDO work in my server (PWS), could you please guide me ?
Here is my HTML code file :


<html>
<head>
<link rel="stylesheet" href="../design.css" type="text/css">
</head>

<body>
<table>
<form action="default.asp" method="get">
<tr>
<td width=100>First Name: </td>
<td><Input type="text" name="firstname" size=25>
</tr>
<tr>
<td width=100>Last Name: </td>
<td><input type="text" name="lastname" size=25>
</tr>
<tr>
<td width=100>Email address: </td>
<td><input type="text" name="email" size=25>
</tr>
<tr>
<td width=100>Country: </td>
<td><Select name="country">
<OPTION> AFGHANISTAN
<OPTION> ALBANIA
<OPTION> ALGERIA
<OPTION> AMERICAN SAMOA
<OPTION> ANDORRA
<OPTION> ANGOLA
<OPTION> ANGUILLA
(more)
</tr>
<tr>
<td width=100 valign="top">Comment: </td>
<td><Textarea name="comment" rows=6 cols=50 WRAP="VIRTUAL"> </Textarea></td>
<br>
</tr>


<tr>
<td colspan=2 align="center">
<input type="submit" value = "Send E-mail" />
<input type="reset" value = "Reset" />
</td>
</tr>
</form>
</table>

</body>
</html>

And the default.asp file:
<%Set myMail=CreateObject("CDO.Message")
myMail.Subject="BLA BLA BLA"
myMail.From="a@a.a"
myMail.To="anhngocckdt@yahoo.com"
myMail.Cc="c@c.com"
myMail.TextBody = "BLA BLA BLA"

myMail.Send
set myMail=nothing
%>

will it work properly with the ASP code that Alon posted?

russell_g_1
01-15-2006, 03:15 PM
just give it a go. if it dies with a message saying that the cdo.message object couldn't be created then you'll need to setup cdo on your machine.

alon
01-16-2006, 03:04 AM
I have never installed CDO on my localhost, and the code worked properly. Maybe it is installed by default. As Russel said, just give it a go, and pray.

ruurlostraat
01-16-2006, 07:15 AM
I gave it a try but it still does not work. I received this :

Error Type:
CDO.Message.1 (0x80040220)
The "SendUsing" configuration value is invalid.
/MyWeb/email_function.asp, line 8