11

Trying to send a batch file as an email attachment, I get the following error:

mx.google.com rejected your message to the following e-mail addresses:

[email protected]

mx.google.com gave this error: Our system detected an illegal attachment on your message. Please visit http://support.google.com/mail/bin/answer.py?answer=6590 to review our attachment guidelines. q42si10198525wei.6

Your message wasn't delivered because the recipient's e-mail provider rejected it.

This also happens if I place the batch file in a .zip archive. I need to send a batch file to everyone at my company for them to run, preferably without having to change file extensions first. Is this possible by email?

1

7 Answers 7

12

Its a 'security' thing, and in this case, changing the extension is the easiest way to fix it. I did a few tests before and gmail at the very least checks 7zip, and zip files.

You need everyone in the company to run it - use a fileshare and share the link to it internally. You might also be able to upload it somewhere and get the link to the others. In this case getting creative is the best idea.

1
  • Yes, I think I will have to rethink my approach. These are good ideas, thank you.
    – MikeFHay
    Sep 28, 2012 at 9:49
10

I have done it by simply double-zipping it, because Gmail does not unzip and checks recursively.

Archive it in .rar format, then .zip, or .tar.gz, or any other combination of two different archiving formats.

However, it may be a bit of work for some of your recipients to un-archive twice, so the other answers may prove more useful.

2
  • This is excellent, but requires that the recipient be able to open two different archive formats. As far as I'm aware, Windows only supports Zip out of the box, so they would need 7zip or Winrar or something installed.
    – MikeFHay
    Oct 1, 2012 at 9:34
  • @MikeL It may still be simpler than changing the file extension on Win OSes, where extension is hidden by default...
    – Sam
    Oct 1, 2012 at 15:45
5

I don't know of any way you can do it without changing the file extension. The way I usually send .exe or any type of executables through email is by first zipping it, then changin the extension of the zip file (to something made up).

5
  • 1
    Ah, good idea. Telling people to open the file in winzip should be an easy enough instruction. This is a possible solution.
    – MikeFHay
    Sep 28, 2012 at 9:48
  • 1
    Wouldn't it be easier to just tell them to remove the .txt extension? All this zipping and double-zipping is a lot of work on both ends just to send a text file with a .bat extension.
    – ale
    Sep 28, 2012 at 13:47
  • 1
    @Al Renaming the file means first saving it, then renaming it, then running it. Three steps to achieve something which should be trivial. Not to mention that Windows by default doesn't show file extensions, and gives a warning when extensions are changed. For technically-illiterate users, it is far from ideal.
    – MikeFHay
    Sep 28, 2012 at 14:14
  • And that's more difficult than save the zip file, rename it to *.zip, unzip it?
    – ale
    Sep 28, 2012 at 14:31
  • @Al No, renaming the zip would be too much. This answer is only good enough if the "Open with" dialogue lets them open a .zipfoo file in Windows Explorer. Unfortunately that doesn't appear to be the case.
    – MikeFHay
    Sep 28, 2012 at 15:03
4

Put it in a password-protected zip file and include the password in the body of the email.

1

The best way to to this is to zip it first (or any compression program). Lost of email providers do not allow sending files which can be run (.exe or .bat for example). Zipping it typically get's round it.

If it still fails, rename the file with .exeXXX (include the xxx) and provide instructions to the recipient that they will have to rename the file before executing on remote machine.

In your case, rename it to .batXXX

3
  • He dosen't want to rename it tho. This is a slightly annoying constraint.
    – Journeyman Geek
    Sep 28, 2012 at 9:45
  • Yes, my users are not all very technically-literate, so I would rather have a file they can simply double-click on and let it run. Obviously that would defeat the whole purpose of this security measure, so I'm doubtful that there is a solution. I may have to re-think my approach.
    – MikeFHay
    Sep 28, 2012 at 9:55
  • 1
    Actually, if you do allow staff to run a .bat or .exe, it would allow any staff to run anything like this (virus anyone?) - yes, it is a security risk and one I would advise to proceed cautiously.
    – Dave
    Sep 28, 2012 at 10:15
0

Put it in a folder and compress the folder with RAR. Then put the .rar into another folder then zip it. Provide them a download link for WinRAR and tell them how to open the batch to execute.

0

Tested on mac

Here are 3 simple steps to bypass gmail security:

  1. Compress your files to myFile.zip
  2. Rename the file from myFile.zip to myFile
  3. Compress the file with password.
    • In mac open command line and run: zip -er myZipFileName.zip locationOfmyFile
      it will ask you to enter password and confirm it before it will zip it.
    • In windows use winrar.

Now email it up!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .