<% ' change to address of your own SMTP server strHost = "smtp.broadviewnet.net" ' We use AspUpload component to capture uploaded file and access other form items. ' Because of the special ENCTYPE attribute we can no longer use Request.Form, ' we must use Upload.Form instead. ' More more info on AspUpload, visit www.aspupload.com. Set Upload = Server.CreateObject("Persits.Upload") Upload.IgnoreNoPost = True ' capture an upload and save uploaded files (if any) in temp directory Upload.Save "c:\upload" ' Note that we cannot use Upload.Form or Upload.Files until Upload.Save is called. If Upload.Form("Send") <> "" Then Set Mail = Server.CreateObject("Persits.MailSender") Mail.From = "info@persits.com" Mail.FromName = "Attachment Demo" Mail.Host = strHost Mail.Subject = Upload.Form("Subject") Mail.Body = Upload.Form("Body") Mail.AddAddress Upload.Form("To") ' Handle attached file via Upload.Files collection. ' Check if a file was ineed uploaded If Not Upload.Files("Attachment") Is Nothing Then Mail.AddAttachment Upload.Files("Attachment").Path End If ' We are done. Send message Mail.Send Response.Write "Success!" End If %> AspEmail: UploadAttachment.asp

AspEmail: UploadAttachment.asp

This sample uses the AspUpload component.

An evaluation copy of aspupload.dll can be found in the \Bin directory of the AspEmail installation. For this demo to work, you must register aspupload.dll using regsvr32 unless it has already been registered on your system.
Enter email:
Enter Subject:
Enter Body:
Select File Attachment: