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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Portable CDO email script

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi Everyone,

If I had the follow (below) and I wanted it to read in all Input Boxes then mail it. How can this be done?

So if one was to add or modify Input boxes in the HTML Form the script is still able to cope and mail all input off.

***************************************************

<html>
<body>

<%
If Len(Request.Form(&quot;txtEmail&quot;)) > 0 then
Dim objMail
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)
objMail.From = &quot;mike@mike.com (mike mike)&quot;
objMail.Subject = &quot;Email with an Attachment&quot;
objMail.AttachFile Server.MapPath(&quot;/images/box.gif&quot;)
objMail.To = Request.Form(&quot;txtEmail&quot;)
objMail.Body = Request.Form(&quot;namefield&quot;)

objMail.Send

Response.write(&quot;<i>Mail was Sent</i><p>&quot;)

'You should always do this with CDONTS.
set objMail = nothing
End If
%>

<form method=&quot;post&quot; id=form1 name=form1>

<p><b>Enter your email address:</b><br>
<input type=&quot;text&quot; name=&quot;txtEmail&quot; value=&quot;<%=Request.Form(&quot;txtEmail&quot;)%>&quot;>
</p>
<p>Name: <input type=&quot;text&quot; name=&quot;namefield&quot; value=&quot;<%=Request.Form(&quot;namefield&quot;)%>&quot;> <BR>
attachment: <input type=&quot;file&quot; name=&quot;file1&quot;>
</p>
<p>
<input type=&quot;submit&quot; value=&quot;Email with an Attachment!&quot; id=submit1 name=submit1>
</form>

</body>
</html>
 
It looks fine to me. However, are you expecting the final result to email a file that was selected in your <input type=&quot;file&quot;..> form element.

If so, you're current setup will not do that. You will need a file Uploader utility to first send the form to that utility, then upload the file to your server, then process the mail script to attach that file.

Other than that, it looks like you're doing fine as far as the email address goes. If you change the address, the mail script should see that change.

Were you encountering a specific problem, or is this more of a What If.. type of question?

ToddWW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top