Author |
|
Macca Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 13 October 2005 at 6:58am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 13 October 2005 at 10:39am | IP Logged
|
|
|
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 |
|
|