<% ' 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 ' Perform upload to memory Upload.Save ' 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 = "Memory 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 Set File = Upload.Files("Attachment") If Not File Is Nothing Then Mail.AddAttachmentMem File.FileName, File.Binary End If ' We are done. Send message Mail.Send Response.Write "Success!" End If %> AspEmail: UploadAttachmentMem.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: