Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple attachments with aspmail 2

Status
Not open for further replies.

mok44

MIS
Sep 3, 2002
36
US
I am using aspmail 4, with Access XP, and calling sendmail function from a form. The function presents an attachment dialog box where user can browse and attach documents. However I have been able to do only a single attachment to each email; is there a way to do more than 1 attachmment per email using some sort of seperator like ";"? Or do I have to change my code?
thanks.
 
I'm not familiar with aspmail 4 but, if you do consider changing your code, you can try automation with outlook, which will allow several attachments to be sent with the email.

 
Thanks Zion7 for your response.
I am not sure Outlook would work in this case as I am using ASPMail to broadcast emails to multiple recipients.
Does Outlook allow you to send emails to multiple recipients?
 
Absolutely.

Make a refrence to Microsoft Outlook 11.0 Object Library

sEmail, is a semi colon delimited string of email addresses.
sEmail = "johndoe@Rogers.com; janedoe@aoL.com;tomthumb@AOL.com"

I have a multi-select listbox where the user selects attachments to add

Code:
Sub EmailAttachment(sEmail As String)
Dim appOutLook As Outlook.Application, itm As Object, x As Integer

   Set appOutLook = CreateObject("Outlook.Application")
   Set itm = appOutLook.CreateItem(olMailItem)

   With itm
      .To = sEmail
      .cc = Nz(txtCC, "")
      .BCC = Nz(txtBCC, "")
      .Subject = Nz(txtSubject, "")
      .Body = Nz(txtMessage, "")
          For x = 0 To lstFiles.ListCount - 1
              If lstFiles.Selected(x) = True Then
                  .Attachments.Add lstFiles.ItemData(x)
              End If
           Next x
      .Display
   End With

   Set appOutLook = Nothing
   Set itm = Nothing

End Sub
 
Great!
Thanks Zion7, I will give it a shot and let you know how it goes.
Have a star for following up!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top