I have created an application which allows a user to upload an attachment and when finished, it sends an email with the attachment. That works fine. I've even gotten it to allow the user to upload multiple attachments. However I cannot get it to send more than one attachment with email. It only attaches the last one [i.e. if they upload 3, only the third attachment is sent. I need some help. Here's the code for the email...
- Code: Select all
Dim Jmail
Dim Attachment
Dim ClearAttachments
Dim Attachments
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.ServerAddress = "MAILSERVER"
Jmail.AddRecipient("CylPriceList@parker.com")
Jmail.AddRecipientBCC Session("CustEmail")
Jmail.Sender = Session("CustEmail")
Jmail.SenderName ="Quote Requestor"
Jmail.Subject = "Quote Request"
Jmail.Priority = 1
Jmail.Body = MailBody
set session("BuildPath")= attachment
set attachment = objUpload.files("attachment")
if attachment.IsFile then I've tried this code
msg.AddCustomAttachment attachment.filename, attachment.item, false
end if
and this code...but I'm missing something
FOR Each item in objUpload.files
If attachment <> "" then
set attachment = objUpload.files
Jmail.AddAttachment objUpload.files.Item
end if
next
Jmail.Silent = false
Jmail.Execute
session("BuildPath") = ""
end function
If anyone out there has any idea of what's wrong, please help. Thanks.