[thelist] E-mail attachments in ASP
darren
darren at web-bitch.co.uk
Tue Mar 26 05:44:01 CST 2002
On 26 March 2002 at 02:22:39, aardvark <roselli at earthlink.net> wrote:
>> From: "Jason Lustig" <lustig at acsu.buffalo.edu>
a> [...]
>> 1. How do I get the SMTPsvg.Mailer class to send something as an
>> attachment to the email?
>>
>> 2. How do I get the uploaded file to get itself attached to the email?
>> I don't want to put it on the server or anything, just sent along to
>> the magazine's editor...
a> this help at all?
a> Using files to send emails with IIS, part 1 of 2
a> http://evolt.org/article/part1/17/3419/
a> Using Files to Send Emails with IIS, part 2 of 2
a> http://evolt.org/article/part2/17/3875/
in addition to sgd's article, if you're running win2k you could use cdo and
not cdonts to send your email. this can be set to write out to the pickup
directory and creates the unique identifiers for the email.
lots of info is on msdn...a sample code would look something like:
set objEmail = Server.CreateObject("CDO.Message")
set objConf = Server.CreateObject("CDO.Configuration")
set objFields = objConf.Fields
objFields.Item(cdoSendUsingMethod) = cdoSendUsingPickup
objFields.Item(cdoSMTPServerPickupDirectory) = "d:\inetpub\mailroot\Pickup"
objFields.Item(cdoFlushBuffersOnWrite) = true
' objFields.Item(cdoSendUsingMethod) = cdoSendUsingPort
' objFields.Item(cdoSMTPServer) = "your.mail.relay"
' objFields.Item(cdoSMTPAuthenticate) = cdoBasic
' objFields.Item(cdoSendUserName) = ""
' objFields.Item(cdoSendPassword) = ""
objFields.Item(cdoSendUserReplyEmailAddress) = sFrom
objFields.Item(cdoSendEmailAddress) = sFrom
objFields.Update
set objEmail.Configuration = objConf
objEmail.From = sFrom
objEmail.Subject = sSubject
if inStr(lcase(sEmail), "<html") > 0 then objEmail.HTMLBody = sEmail else objEmail.TextBody = sEmail
' has a path to an attachment been passed in
if len(sAttach) > 0 then objEmail.AddAttachment sAttach
' send email
objEMail.Send
More information about the thelist
mailing list