Click to See Complete Forum and Search --> : mail sent


OPETH
10-19-2006, 07:04 AM
These asp my codes.

<%
'Sends an email
Dim mail
Set mail = Server.CreateObject("CDO.Message")
mail.To = Request.Form("To")
mail.From = Request.Form("From")
mail.Subject = Request.Form("Subject")
mail.TextBody = Request.Form("Body")
mail.Send()
Response.Write("Mail Sent!")

Destroy the mail object!
Set mail = nothing
%>

This my html form

<form method="POST" action="asa.asp">
To <input type="text" name="To"/> <br />
From <input type="text" name="From"/> <br />
Subject <input type="text" name="Subject"/> <br />
Body <textarea name="Body" rows="5" cols="20" wrap="physical" >
</textarea>
<input type="submit" />
</form>

I added to my own hosting ,asp codes and html form.But just dont work.I would like to users send me mails by this method.How can I do this?

I.m.I
10-22-2006, 08:48 PM
did u try it in your localhost

OPETH
10-22-2006, 08:54 PM
Yes,I tried my localhost also my hosting(mysitem) too

Terrorke
10-23-2006, 02:32 AM
Add some lines to your code :



Mail.Configuration.Fields.Item "http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
Mail.Configuration.Fields.Item "http://schemas.microsoft.com/cdo/configuration/smtpserver") ="yourrelayURL" 'ex relay.host.com
Mail.Configuration.Fields.Item "http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Mail.Configuration.Fields.Item "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

Mail.Configuration.Fields.Update



Just change the line of SMPTServer to the correct relay Url of your host.

If you are behind a firewall make sure that your port 25 isn't blocked.