How to send a batch file by email

10

1

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:

foo@googlemail.com

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?

MikeFHay

Posted 2012-09-28T09:34:58.387

Reputation: 2 334

All the answers and comments on answers sound like this: http://xkcd.com/949/

– Alec Gorge – 2012-09-28T17:56:42.277

Answers

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.

Journeyman Geek

Posted 2012-09-28T09:34:58.387

Reputation: 119 122

Yes, I think I will have to rethink my approach. These are good ideas, thank you. – MikeFHay – 2012-09-28T09:49:21.033

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.

Sam

Posted 2012-09-28T09:34:58.387

Reputation: 201

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 – 2012-10-01T09:34:23.660

@MikeL It may still be simpler than changing the file extension on Win OSes, where extension is hidden by default... – Sam – 2012-10-01T15:45:21.423

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).

m4573r

Posted 2012-09-28T09:34:58.387

Reputation: 5 051

1Ah, good idea. Telling people to open the file in winzip should be an easy enough instruction. This is a possible solution. – MikeFHay – 2012-09-28T09:48:02.173

1Wouldn'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 – 2012-09-28T13:47:21.793

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 – 2012-09-28T14:14:48.567

And that's more difficult than save the zip file, rename it to *.zip, unzip it? – ale – 2012-09-28T14:31:17.557

@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 – 2012-09-28T15:03:35.087

3

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

Jeremy Stein

Posted 2012-09-28T09:34:58.387

Reputation: 584

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

Dave

Posted 2012-09-28T09:34:58.387

Reputation: 24 199

He dosen't want to rename it tho. This is a slightly annoying constraint. – Journeyman Geek – 2012-09-28T09:45:21.367

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 – 2012-09-28T09:55:15.157

1Actually, 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 – 2012-09-28T10:15:17.370

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.

John

Posted 2012-09-28T09:34:58.387

Reputation: 9

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!

Ilya Gazman

Posted 2012-09-28T09:34:58.387

Reputation: 101