Search The ForumSearch   RegisterRegister  LoginLogin

MailBee SMTP

 AfterLogic Forum : MailBee SMTP
Subject Topic: Multiple attachments Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Macca
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 13 October 2005 at 6:58am | IP Logged Quote Macca

Hi there,

Is there a way of adding all the files in a folder as email attachments.

I have got a folder called Attach, and when the email is sent there may be upto 5 files in this folder, but I wont know the names of these files.

Is there a command to add everything?

Many thanks

Andy
Back to Top View Macca's Profile Search for other posts by Macca
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 13 October 2005 at 10:39am | IP Logged Quote Alex

You can use the Message.AddAttachment method in conjunction with FileSystemObject object to attach the files with unknown names from the specified folder, as shown below:

Code:

' Assume all the properties of SMTP.Message already set

Set fso = CreateObject("Scripting.FileSystemObject")

Set folder = fso.GetFolder("C:\Temp\Attachment")

Set filesCol = folder.Files

For Each singleFile in filesCol
   SMTP.Message.AddAttachment singleFile.Path
Next

Set fso = Nothing
Set folder = Nothing
Set filesCol = Nothing

SMTP.Send


Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide