| Author |
Message |
Xavier
Guest
|
Posted:
Sat Nov 19, 2005 5:58 pm Post subject:
help needed for script : sending binary attachment ? |
|
|
Hello,
I am using the following script to retrieve XML files off a Small Business
Server 2003 and send them automatically. The script enumerates the files
found in a particular directory and add them as attachment in a mail that
gets sent to a particular email address. As long as the files in the
directory are text or xml files, everything runs fine. When the files are
binary files, the attachment are corrupted, or the mail gets stucked in the
Exchange queues.
As I am neither a scripting guru nor an Exchange specialist, I wonder if
someone could have a look at the script and tell me if a specific method
must be used to send binary attachments ?
----------------------------------------
Set fsobject = CreateObject("Scripting.FileSystemObject")
Set folder = fsobject.GetFolder("C:\Source-Directory")
Set fc = folder.Files
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "Source"
objEmail.To = "recipient@domain.com"
objEmail.Subject = "Some Files"
For Each fichier in fc
objEmail.AddAttachment(fichier)
Next
objEmail.Send
Set fsobject = Nothing
Set folder = Nothing
Set fc = Nothing
Set fichier = Nothing
------------------------------------
Any help would be appreciated.
Thanks,
Xavier
|
|
| Back to top |
|
 |
Glen Scales [MVP]
Guest
|
Posted:
Mon Nov 21, 2005 1:58 am Post subject:
Re: help needed for script : sending binary attachment ? |
|
|
One thing you might want to try is adding the attachment manually via the
attachments collection using an ADO stream have a look at the sample in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_cdo_manually_adding_attachments.asp.
If its binary content you have you should just be able to write the binary
content into the stream using a stream.write.
Cheers
Glen
"Xavier" <xminet@remove-this.hotmail.com> wrote in message
news:Ow0DGIR7FHA.3984@TK2MSFTNGP11.phx.gbl...
| Quote: | Hello,
I am using the following script to retrieve XML files off a Small Business
Server 2003 and send them automatically. The script enumerates the files
found in a particular directory and add them as attachment in a mail that
gets sent to a particular email address. As long as the files in the
directory are text or xml files, everything runs fine. When the files are
binary files, the attachment are corrupted, or the mail gets stucked in
the Exchange queues.
As I am neither a scripting guru nor an Exchange specialist, I wonder if
someone could have a look at the script and tell me if a specific method
must be used to send binary attachments ?
----------------------------------------
Set fsobject = CreateObject("Scripting.FileSystemObject")
Set folder = fsobject.GetFolder("C:\Source-Directory")
Set fc = folder.Files
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "Source"
objEmail.To = "recipient@domain.com"
objEmail.Subject = "Some Files"
For Each fichier in fc
objEmail.AddAttachment(fichier)
Next
objEmail.Send
Set fsobject = Nothing
Set folder = Nothing
Set fc = Nothing
Set fichier = Nothing
------------------------------------
Any help would be appreciated.
Thanks,
Xavier
|
|
|
| Back to top |
|
 |
Xavier
Guest
|
Posted:
Tue Nov 22, 2005 1:58 am Post subject:
Re: help needed for script : sending binary attachment ? |
|
|
Thanks,
I'll give it a try.
Xavier
"Glen Scales [MVP]" <gscales@outlookexchange.com> wrote in message
news:OPrR8xi7FHA.2676@TK2MSFTNGP15.phx.gbl...
| Quote: | One thing you might want to try is adding the attachment manually via the
attachments collection using an ADO stream have a look at the sample in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_cdo_manually_adding_attachments.asp.
If its binary content you have you should just be able to write the binary
content into the stream using a stream.write.
Cheers
Glen
"Xavier" <xminet@remove-this.hotmail.com> wrote in message
news:Ow0DGIR7FHA.3984@TK2MSFTNGP11.phx.gbl...
Hello,
I am using the following script to retrieve XML files off a Small
Business Server 2003 and send them automatically. The script enumerates
the files found in a particular directory and add them as attachment in a
mail that gets sent to a particular email address. As long as the files
in the directory are text or xml files, everything runs fine. When the
files are binary files, the attachment are corrupted, or the mail gets
stucked in the Exchange queues.
As I am neither a scripting guru nor an Exchange specialist, I wonder if
someone could have a look at the script and tell me if a specific method
must be used to send binary attachments ?
----------------------------------------
Set fsobject = CreateObject("Scripting.FileSystemObject")
Set folder = fsobject.GetFolder("C:\Source-Directory")
Set fc = folder.Files
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "Source"
objEmail.To = "recipient@domain.com"
objEmail.Subject = "Some Files"
For Each fichier in fc
objEmail.AddAttachment(fichier)
Next
objEmail.Send
Set fsobject = Nothing
Set folder = Nothing
Set fc = Nothing
Set fichier = Nothing
------------------------------------
Any help would be appreciated.
Thanks,
Xavier
|
|
|
| Back to top |
|
 |
|
|
|
|