Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

submitting a form

Status
Not open for further replies.

brad10

Technical User
Jun 5, 2001
33
GB
What is the simplest way of sending form results to an e mail address and then on submission going to a page that confirms to the user that the form has been sent. I have this in my code at the moment but it is not sending the data;

<script language=&quot;JavaScript&quot;>
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args+&quot;.location='&quot;+args[i+1]+&quot;'&quot;);
}
//-->
</script>



<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;mailto:blah.blah@blah.co.uk&quot; enctype=&quot;text/plain&quot; onSubmit=&quot;MM_goToURL('parent','confirmsent.htm');returndocument.MM_returnValue&quot;>

 
brad10,

I would post to an ASP page first, verify your data and then send the message.


Cheers,
fengshui1998

<%
Set objMail = Server.CreateObject(&quot;CDONTS.Newmail&quot;)
objMail.From = &quot;FromAddress&quot;
objMail.To = &quot;ToAddress&quot;
objMail.Cc = &quot;CCAddress&quot;
objMail.Bcc =&quot;BlindCopyAddress&quot;
objMail.Subject = &quot;Subject sentence&quot;
objMail.Body = &quot;Data here&quot;
objMail.Send
Set objMail = Nothing
%>
 
Yes post it to an ASP page then as long as ASPmail is installed on the server you can use this.

Set mail = Server.CreateObject(&quot;Persits.Mailsender&quot;)
Mail.Host = &quot;A Valid mail host&quot;



strName = request.form(&quot;Name&quot;)
stremail = request.form(&quot;Email&quot;)


Mail.From = stremail
Mail.FromName = strName
Mail.AddAddress &quot;Your email address&quot;
Mail.AddAddress &quot;stremail if you want it posted back to them&quot;
Mail.AddReplyTo &quot;&quot;
'Mail.AddAttachment &quot;c:\any file&quot;
strBodyHeader = &quot;&quot; & chr(13) & chr(10) & chr(13) & chr(10)
strBodyHeader = strBodyHeader & &quot;Name : &quot; & strName & chr(13) & chr(10)
strBodyHeader = strBodyHeader & &quot;Email : &quot; & stremail & chr(13) & chr(10)
strBody = strBodyHeader & strBody
Mail.Subject = &quot;A Form has been posted&quot;
Mail.body = strBody
'Mail.Body = &quot;&quot; & Chr(13) & Chr(10) & &quot;Thank you for your business.&quot;


On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write &quot;Error encountered: &quot; & Err.Description
End If
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top