Corrupted file when sent through mail

Hello,
I wrote a script  that, among other things, sends an email with an attached binary file.
This goes through an SMTP relay server.
The problem is that the file gets corrupted along the way. something, somewhere, removes all 0x00 entries within the binary file.
I wonder if this could be due to the method I use to send the email.
Could someone have a look at this sub please ?
Sub SendMail (AttachmentFile)
Const SMTPServer = "zcabb37s.mydom.com"
Const SMTPServerPort = 25
Const MailExp = "[email protected]"
Dim Recipents, objMessage
Recipents = ""
For i = 0 To WScript.Arguments.Count - 1
If Len (Recipents) = 0 Then
Recipents = WScript.Arguments (i)
Else
Recipents = Recipents & "; " & WScript.Arguments (i)
End If
Next
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Stats du jour"
objMessage.From = MailExp
objMessage.To = Recipents
On Error Resume Next
objMessage.AddAttachment AttachmentFile
If Err.Number <> 0 Then
Call Echo ("Could not find attachment : " & " - " & Err.Number & Err.Source & " - " & Err.Description, 12)
Call Echo ("with " & AttachmentFile, 1)
WScript.Quit (5)
End If
On Error Goto 0
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPServerPort
objMessage.Configuration.Fields.Update
On Error Resume Next
objMessage.Send
If Err.Number <> 0 Then
Call Echo ("Could not send mail : " & " - " & Err.Number & Err.Source & " - " & Err.Description, 12)
Call Echo ("to " & Recipients, 1)
Call Echo ("with " & AttachmentFile, 1)
WScript.Quit (5)
End If
On Error Goto 0
Call Echo ("Mail sent to : " & Recipents & ".", 1)
Call Echo ("with attached file : " & AttachmentFile, 1)
End Sub

This is not a scripting issue. Contact the server vendor or admin and ask them why they are doing that.
Perhaps you have a Unicode file that is being handled incorrectly.  EXE files and binary files are usually blocked by mail systems.
The CDO package does not alter files.  Only mail servers and mail clients will do that.
 Try sending the file with PowerSHell to see that the same thing happens.
¯\_(ツ)_/¯

Similar Messages

  • Corrupt workbook when sent through email

    Hi,
    I have setup a precalculation server on a Windows XPSP2 PC, installed Excel 2003SP3 and SAPGUI 640p24.
    When calculating a workbook, it's created correctly (as I can open it on the client in the C:\Windows\temp folder), but the sent zip file with the workbook is corrupt.
    The tracelog file shows the following entries at the end of the distribution:
    BExCompression.SupportsCompression: Compression NOT supported
    File or assembly name vjslib, or one of its dependencies, was not found.
    BExConnect.Closed
    When i display logs in transaction RSPRECADMIN I can see a lot entries with the following message:
    DataTable iServerProperties  DataTable iVarTable) Boolean[] CopyBack)  String[] namedParameters)
    and also:
    Unresolved exception occurred on the precalculation server
    I don't find any obvious problems in the BexPreCalcLog.
    I have setup everything according to to the u201CHow Tou2026Troubleshoot Information Broadcasting (BEx Workbooks)u201D pdf.
    Additional Info:
    BI_CONT - 703 - 0008

    Thanks for your quick response WernerS.
    I have verified and reinstalled both J# 2.0 and .NET 2.0
    However, when trying to execute the workbook now, I can see that on the remotePC where the PreCalc server is installed, Excel uses up almost 80mb RAM before excel returns an error in a popup saying:
    Not enough system resources to display completely
    I also check the tracefiles and see this error in them:
    BExConnect.Trace3: 0
    BExExcelTraceListener.AddTraceListener: Added a tracelistener for Version: 7005.5.578
    BExConnect.constructor2: 140,471447
    BExMenu.CreateSubMenu1: 0
    BExMenu.CreateSubMenu2: 0.156253
    BExMenu.AdjustToolbarsSubMenu: lApplication is nothing
    BExMenu.AdjustToolbarsSubMenu: lApplication is nothing
    ListSeparator: ,
    ExcelVersion: 11.0
    BExAddin, Version=7000.0.0.0, Culture=neutral, PublicKeyToken=null
    BExConnect.New: There was already a Connect Object.
    BExConnect.constructor2: 0
    GetSystemInformation
    SUNI Const: 0
    CommunicationFactory.GetSystemInformation (Setting Conn 1)): 0
    CommunicationFactory.GetSystemInformation (Setting Conn 2)): 0
    CommunicationFactory.GetSystemInformation (Setting init Propties)): 0
    CommunicationFactory.GetSystemInformation (SUNI.FUNCTION_EXISTS)): 0.312506
    RSR_XLS_RFCtrc: 13.594011
    CommunicationFactory.GetSystemInformation (RSR_XLS_NET_INTERFACE)): 14.531529
    CommunicationFactory.GetSystemInformation (XML Stuff)): 15.6253
    CommunicationFactory.GetSystemInformation (Prop Stuff)): 15.6253
    CommunicationFactory.GetSystemInformation (Version)): 15.6253
    CommunicationFactory.ObtainSystemInformationandCheckVersion (GetSysInfo)): 15.937806
    CommunicationFactory.ObtainSystemInformationandCheckVersion (CheckAfterLogin)): 0.156253
    CommunicationFactory.LogOnUsingComConnection (ObtainSystemInfo)): 16.094059
    CommunicationFactory.LogOnUsingComConnection (MainConnectionChangedEvent)): 1.406277
    BExExcelApplication.UnhookDesignMode: Hooked=False
    BExItems.CreateFromDeSer: Trying to deserialize the Items...
    -------------------6/9/2008 2:35:31 PM-------------------
    System.Runtime.InteropServices.COMException (0x800A03EC): Unable to set the Calculation property of the Application class
       at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object o, Type& objType, String name, Object[] args, String[] paramnames, Boolean OptimisticSet, CallType UseCallType)
       at Microsoft.VisualBasic.CompilerServices.LateBinding.LateSetComplex(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean OptimisticSet, Boolean RValueBase)
       at com.sap.bi.et.analyzer.addin.BExExcelApplication.SetDirty()
       at com.sap.bi.et.analyzer.addin.BExConnect.OnOpen(Object iWorkbook)
    Unable to set the Calculation property of the Application class
       at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateSet(Object o, Type& objType, String name, Object[] args, String[] paramnames, Boolean OptimisticSet, CallType UseCallType)
       at Microsoft.VisualBasic.CompilerServices.LateBinding.LateSetComplex(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean OptimisticSet, Boolean RValueBase)
       at com.sap.bi.et.analyzer.addin.BExExcelApplication.SetDirty()
       at com.sap.bi.et.analyzer.addin.BExConnect.OnOpen(Object iWorkbook)

  • Size of photo file when sent through imessage

    WWhen I text a photo on iMessage does it send the photos full file size?

    I was sure this curse was an Android feature since I had it constantly with my Nexus phones for the last two years, but sure enough it affects iOS8 too. Turn off wireless and and your MMS will go out fine over cellular ever time (in my experience anyway). Ridiculous, right?

  • Emails always are suck in outbox when sent through Apple mail

    Emails always are suck in outbox when sent through Apple mail. How should I deal with it ? Many thanks!

    As mentioned, Outlook is not email standards compliant. It probably never will be based on Microsoft's history. However, I think there are various issues involved in the problems people have. I often send emails from home to my Outlook account at work. I have never experienced any of the problems that I've seen posted anywhere regarding Mail and Outlook.
    My conclusion is that there are issues with certain Exchange Server configurations and/or issues with your own ISP mail server causing the issues.
    I do have my system set up to Always send windows friendly attachments (from what I've read, this really is 'send Outlook friendly attachments'), and always put attachments at the end. Prior to the 'always put attachments at the end,' I wasn't having any issues, either. However, I read that that setting helped with other email clients, so I use it.
    The obvious question is, "well, how is your exchange server configured." I would love to provide the answer to that question; however, I work for a DoD organization, so actually tracking down the person that knows the answer to that question will take somewhere between five years and never. With my 20+ years experience with the DoD, I'm leaning towards the never end of the spectrum. The other half of the equation is, "I'm using cox as my ISP."

  • I am running Vista and Windows Mail, I can not open PDF files when in Windows Mail, I must save to Desktop first, this has changes recently and I do not know why or how to fix

    I am running Vista and Windows Mail, I can not open PDF files when in Windows Mail, I must save to Desktop first, this has changes recently and I do not know why or how to fix.
    Why after 6 year's this has changed?
    I would like to open PDF's straight from Window Mail.

    Good day Jeff.
    I am running most current Adobe Reader X.
    Tks Mark

  • Attaching HTML file and sending through mail

    Hi
    My Requirement is
    I want to attach HTML File and send through mail id's.
    But there are number of html files
    user can select any  one file.
    it has to attach and send to the mail id.

    Hi V,
    check the link:
    http://wiki.sdn.sap.com/wiki/display/Snippets/SendEmailwithHTMLattachment.

  • My pictures are saying delivered when sent through iMessage but the person isn't actually getting them. How do I fix this?

    My pictures are saying delivered when sent through iMessage but the person isn't actually getting them. How do I fix this?
    My pictures send through iMessage only to certain people. And others the message is saying " delivered" but the person on the other end isn't getting any of my picture messages and sometimes regular iMessages with no pictures.

    I was sure this curse was an Android feature since I had it constantly with my Nexus phones for the last two years, but sure enough it affects iOS8 too. Turn off wireless and and your MMS will go out fine over cellular ever time (in my experience anyway). Ridiculous, right?

  • Yahoo mail sent through Mail app do not appear when login into Yahoo mail

    Hi everybody,
    I have a problem that annoying me very much. I've used Yahoomail for very long before I bought a MBA. For the first time I use Mac OSX, I try to use Mac mail combine with my old Yahoo mail. Actually, I have done the config. But anything I do with my Yahoo mail through Mail app can't appear when I login into original Yahoo mail. For example: I sent a Yahoo mail through Mac mail, it's shown that the mail was sent sucessfully, but when I try to login into Yahoo mail on Web, the sent mail doesn't exist. And the same happen when I do the opposite: the mail I sent on Yahoo mail doesn't exist on Mac mail. It's a big trouble if I use other lap and try to contact with someone. So is there any solution can fix it?
    Many thanks

    I'm having the same problem, and the only help I ever seem to find suggested anywhere is "make sure its set up as an IMAP account"
    BUT it is! Mail automaticly sets all yahoo accounts up as IMAP. So is this just a yahoo problem? Is there anyway to fix this?
    For me the bigger issue isnt that I need to be able to check my e-mail through a web browser regulerly, but on my Iphone and Ipad the account, which is through the mail app, also dosnt show sent mail sent through the mac app.
    I agree this makes mail on my mac totally usless.

  • Attachments sent through Mail in iOS (any version) are received as corrupt.

    Hello! If I send any attachment through Mail in iOS (can be iPads and iPhones, multiple versions) with my Exchange account, these attachments will arrive to their destination corrupt (as in, they cannot be opened). I've got Exchange 2007 in my company. I know that this is not an iOS problem or Mail problem, since if I send the same exact attachments via another service, say Gmail for example, it arrives correctly to the sender.
    I have not done anything to the Exchange server so far, I just wanted to know if there's someone that can lead us in the correct direction.
    At first I thought the problem was with iOS since is started around the day we upgraded to iOS 7.1. We've upgraded to the newer 7.1.1 version of iOS but this has not resulted in a correction of the problem.
    Any thoughts or ideas?
    - James.

    This is not an iPhone problem or an iOS problem as you seem to be aware.
    As for troubleshooting the attachment corruption problem, I'd think your best resource would be Microsoft.

  • Photos are split in 2 files when sent by Apple Mai, why?

    Anybody encountered the same problem?
    if sending a photo by mail, my web.de account would show the recieved email with 2 files instead of one!!
    Also if I send photos to my msn.com account, there appears the same phenomenon.
    I can't open these 2 files with my Windows Pc, but if loading them to my Powerbook, I can open one file (the photo) but the other file would appear as a thumbnail and can't be opened by any program.
    What's odd:
    if I send a photo with apple mail in connection with iphoto, there would appear the same problem if choosing the original size of the photo.
    BUT if I choose another size (big, or small for example) the
    email arrives without any phenomenon. The photo is usable also in my Windows Pc then.
    Another strange thing:
    I use Apple mail/ entourage (on my Apple) for recieving emails. So if I send a photo with original size to myself (as an experiment) the programs actually show only 1 file as it should be. (Remember: the web.de account and the msn.com account would show the same email with 2 files instead!)
    If loading the photo (any photo) manually by my web.de account and sending it with the web.de account the email would appear in every case with the one file (photo) as it should arrive.
    Does Apple Mail have encoding problems? And why does my entourage program have the exactly the same problem???
    Why doees the problem disappear if I change the photo size with iphoto in connection with Apple mail / entourage?

    I have to add something:
    the two files the photo is split to are:
    1) the bigger one is the jpeg file, the photo itself.
    2) the smaller one is a TIFF file, which can be only displayed if loaded to my Powerbook. Its a miniature view / icon of the jpeg photo.
    On the Windows Pc both files can't be displayed!
    The pictures were taken with my Canon IXUS 800 IS and were imported through iphoto.
    Another important thing I discovered:
    Other photos, taken by other digicams make no trouble when sent by Apple mail or Entourage, ...
    Anybody has an idea how to fix this?

  • Emails sent through Mail 7.0 on Mac won't appear in the Sent folder in the Yahoo web browser or the Mail app for iPad.

    It seems that emails I send via Mail on my mac are stored only in Mail's Sent folder. These emails don't appear in the sent folder of Yahoo web browser, iPad Mail app, or the Y! Mail android app..
    I've tested to see whether my emails are actually sending properly, and they are. I just want to know why the Sent messages on my mac aren't appearing anywhere else. I've read similar issues to this but haven't yet found a reason or solution.
    Thanks in advance

    [edit] I dragged the email I sent through the MBP Mail app (under MAILBOXES > Sent > Yahoo!) to the highlighted Sent folder (YAHOO! > Sent), and now it shows up on all Yahoo Sent folders (iPad app, web browser, phone app). Not entirely solved the issue but will use web browser to sent future emails to keep everything in sync.

  • IV To be sent through Mail

    Dear SAP Experts,
    Can anyone provide me the solution for given scenario?
    I have a requirement regarding workflow.
    I want that when my user will do a Invoice Verification at the same time one copy of IV will go to respective HOD through mail.
    Can I do this with help of Work flow?
    IF yes then please provide me the solution?
    Is there any other way?
    Thanks in advance.
    With Regards,
    Patanjali Bhagat

    OK. I got the answer from another forum.

  • Can't overwrite files once sent as Mail attachments

    Apparently Mail claims a file once sent as an attachment and won't release it unless Mail is quit. Meaning you can't save over pdf's or jpegs once you email them. Puts a kink in my work flow. All day I see... can't create PDF, file is in use. No it's not! Any crafty work arounds out there? I could have sworn they fixed this in Snow Leapord. Thanks in advance.

    This is definitely a bug. Here is an other discussion:
    https://discussions.apple.com/message/23651809#23651809

  • Corrupt file when Downloading iTunes+Quicktime

    Im on my sisters laptop and when I try to install iTunes, it says there is a corrupt file. Im sorry if someone else has had this problem and Im just repeating it. But, she has had iTunes before, but had her pc wiped out. Could that have something to do with it? And is anyone else having this problem

    There is a very comprehensive post on the subject at this link: "What to do if Windows displays an "iTunes.exe - Corrupt File" message" http://discussions.apple.com/message.jspa?messageID=1726580#1726580

  • Photoshop Corrupting Files When Rendering Gradients

    Hello there, I'm a first time poster, with a long time problem.
    My Photoshop is corrupting files in a very destructive fashion, and it seems to be tied to the live rendering of gradients. Not just blur filters, as in this thread (http://forums.adobe.com/thread/751036?start=200&tstart=0) but opacity adjustments in layers, and hue/brightness shifts. This happens usually in files with large dimensions, but not necessarily complicated layer structures.
    This type of corruption, which renders blocks, tesselated shapes, or inverts/fills odd layers, seems to be a problem for multiple users, but I haven't seen a solution.
    I think I may be the first person to link it directly to the live rendering of gradients- rather than just the blur filters. Anything that has to render a gradated shift across the image seems to be the culprit. Usualy starting as a solid, and ending as a transparent. However, simply adjust hue/brightness over an opaque layer will make the corruption happen as well. Which leads me to believe that this corruption is caused by live on screen rendering of gradient shifts.
    Does anyone have any further thoughts or potential solutions?
    Here are my specs:
    CS6 13.0.4 x 64
    Mac OSX v.10.7.5
    3.2 GHz Quad-Core Intel Xeon
    12 GB 1066 MHz DDR3

    I do not understand what you writing in either append.  Please post some  screen capture that show us  the problems your having. Its hard to be the first person to do anything . Your most likely not the first one.

Maybe you are looking for