Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
All the answers and comments on answers sound like this: xkcd.com/949 –  Alec Gorge Sep 28 '12 at 17:56
add comment

6 Answers

up vote 11 down vote accepted

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.

share|improve this answer
    
Yes, I think I will have to rethink my approach. These are good ideas, thank you. –  MikeFHay Sep 28 '12 at 9:49
3  
+1 Internal link, dropbox link, etc. –  WernerCD Sep 28 '12 at 12:47
add comment

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

share|improve this answer
    
He dosen't want to rename it tho. This is a slightly annoying constraint. –  Journeyman Geek Sep 28 '12 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 '12 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 Rook Sep 28 '12 at 10:15
add comment

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

share|improve this answer
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 '12 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. –  Al E. Sep 28 '12 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 '12 at 14:14
    
And that's more difficult than save the zip file, rename it to *.zip, unzip it? –  Al E. Sep 28 '12 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 '12 at 15:03
add comment

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.

share|improve this answer
    
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 '12 at 9:34
    
@MikeL It may still be simpler than changing the file extension on Win OSes, where extension is hidden by default... –  vasile Oct 1 '12 at 15:45
add comment

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

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.