PDA

View Full Version : smtp script help for a formtomail



rolan
21 Mar 2011, 07:07 AM
pls can you help soooooo appreciate this.... script as follows. basically i would like users to be able to submit the form >straight to my email. users do not have email accounts, hence form to mail, and not mailto (as i understand) and have confirmed that the server is working fine...thanks again.....
<form action="formtomail.asp" method="post">
<table>
<tbody>
<tr>
<td><font face="Arial" color="#0000ff"><strong>UserName</strong></font></td>
<td><input maxlength="100" name="UserName">&nbsp; </td></tr>
<tr>
<td><font face="Arial" color="#0000ff"><strong>Contract</strong></font></td>
<td><input maxlength="100" name="Contract">&nbsp; </td></tr>
<tr>
<td>
<p align="center"><font face="Arial"
color=#0000ff><strong>Query</strong></font></p></td>
<td><textarea name="comments" rows="10" cols="50"></textarea> </td></tr>
<tr>
<td></td>
<td><input type="submit" value="Submit">
</td></tr></tbody></table></form></font></a><%
For Each x In Request.Form
message = message & x & ": " & Request.Form(x) & CHR(10)
Next
set smtp=Server.CreateObject("ASPMAIL.smtp")
smtp.Server="xxxxxxxxxxxxxxxcapita.co.uk"
smtp.Rcpt="xxxxxxxxxxxxxxxxx@capita.co.uk"

smtp.FromName="Username"
smtp.Subject="Eptica Query"
smtp.Message = message
on error resume next
smtp.Send
if err then
response.Write err.Description
else
Response.redirect ("http:// redirect.com")
end if
set smtp = Nothing
%>
<p></p></h1>
<h1></h1></h1></body></html>

Clockwork Bear
21 Mar 2011, 10:29 AM
Hi,

You may find this tutorial helps http://www.tizag.com/aspTutorial/aspFormsEmail.php . It does it a bit differently, e.g. using a separate file to process the form, but it should help. If it doesn't let me know and I can try help you out.

Regards

Adam