Hi,
I'm new here, but wondering if anyone can offer some assistance with a bit of code i am writing.
Some quick background, we have a customer that wants to receive all of their invoices via email once per month. We have a store for the invoices, which i am planning on downloading the files from, and then attaching them to multiple emails, attaching a maximum of 25 invoices per email to keep the email sizes down. The customer receives about 180+ invoices a month currently from us, so you can understand why they would want these coming in a few emails rather than hundreds.
Below is the VBScript as far as i have been able to get it, but i need a way of it knowing once it gets to 25 attachments added, that it needs to create a new email.
Thanks,
Rob
I'm new here, but wondering if anyone can offer some assistance with a bit of code i am writing.
Some quick background, we have a customer that wants to receive all of their invoices via email once per month. We have a store for the invoices, which i am planning on downloading the files from, and then attaching them to multiple emails, attaching a maximum of 25 invoices per email to keep the email sizes down. The customer receives about 180+ invoices a month currently from us, so you can understand why they would want these coming in a few emails rather than hundreds.
Below is the VBScript as far as i have been able to get it, but i need a way of it knowing once it gets to 25 attachments added, that it needs to create a new email.
vbscript said:strFolder = "G:\Scripts\Files\"
strExt = "pdf"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
For Each objFile in objFolder.Files
strFileExt = objFSO.GetExtensionName(objFile.Path)
strFile = objFile.Path
next
'email the files, there are usually no more than 3 files.
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "test email script"
objMessage.From = "***@***.com"
objMessage.To = "****@***.com"
objMessage.TextBody = "Please see the attached files"
For Each objFile In objFolder.Files
strFileExt = objFSO.GetExtensionName(objFile.Path)
objMessage.AddAttachment objFile.Path
Next
objMessage.Configuration.Fields.Item (" = 2
objMessage.Configuration.Fields.Item (" = "******@******.com"
objMessage.Configuration.Fields.Item (" = 25
objMessage.Configuration.Fields.Update
objMessage.Send
Thanks,
Rob