Enter your email address:

Source Code:
If Len(Request.Form("txtEmail")) > 0 then

	Dim objMail
	Set objMail = Server.CreateObject("CDONTS.NewMail")

	objMail.From = "info@4guysfromrolla.com (4GuysFromRolla.com)"
	objMail.Subject = "Email attachment demo"
	objMail.AttachFile Server.MapPath("/images/new468x60.gif")
	objMail.To = Request.Form("txtEmail")
	objMail.Body = "This is a demo on sending an email with an attachment."

	Response.write("<i>Mail was Sent</i><p>")

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

  <form method="post" id=form1 name=form1>
    <b>Enter your email address:</b><br>
    <input type="text" name="txtEmail" value="<%=Request.Form("txtEmail")%>">
    <input type="submit" value="Send me an Email with an Attachment!" id=submit1 name=submit1>

[Return to the FAQ] | [Return to the Email FAQ Category]