Helping people with computers... one answer at a time.

Gmail and other mail programs or services will often block attachments using file types frequently used by malware. I'll show you how to send them anyway.

Can I get Gmail to send executable file attachments; if I can, how do I do so?

Yes. There are actually a variety of ways, so I'll cover a couple of the most common.

The good news is that they tend to work regardless of what email service (Gmail or anything else) that you use.

I'll also explain why Gmail might block this type of attachment and how even the workarounds are fairly secure.

Let's say that I want to send a copy of procexp.exe to someone as an attachment. (Side note: This is an example only - the proper way to get procexp.exe is to download it from Microsoft.)

Gmail's block of an attempt to send an executable file

As you can see, it's blocked because Gmail recognizes that ".exe" is an executable file.

We're going to have to trick Gmail.

Rename the file

The first approach is to simply rename the file that you're attempting to send or make a copy with a different name, making sure to change the extension. So procexp.exe, which we see Gmail blocking above, might be renamed to "procexp.leo", as ".leo" is not an extension that indicates an executable file.

Gmail with a renamed attachment

You'll need to include instructions for your recipient to save and then rename the attachment back to its original name in order to use it.

Zip the file

Another approach is to use a zipping utility like WinZip, or my favorite, 7-zip, to create a ".zip" archive that includes the file you want. An additional benefit is that you can include more than one file in the archive and the archive will typically be compressed to be smaller than the original file.

Gmail sending a .zip

Whoops...

Gmail blocking a .zip containing a .exe

While this technique works with many mail systems, Gmail is smart enough to peek inside the .zip file and notice that there's a ".exe" file within. As a result, it blocks the send.

Because I use 7-zip, I'll create a ".7z" archive and send that instead:

Gmail sending a .7z archive

That worked. In this case, you would then instruct your recipient to get 7-Zip if he or she didn't already have it and use it to extract files from the archive.

Rename the zip

Finally, ".zip" file format is probably easier for most, as support for it is built into Windows. So instead of using an alternate archive format, I'll just create the .zip as I did above, but rename it before I send it:

Gmail sending a .zip file renamed as .leo

Note that I used the same non-executable file extension, ".leo" as I did before. It doesn't matter what you use as long as it's not one of the file extensions that your mailer might consider to be an executable program, like ".exe".

And once again, you'll need to instruct your recipient to rename the file from ".leo" (or whatever you choose) to ".zip" so that they can then access the contents.

What's the security issue, anyway?

What Gmail is attempting to protect against is that malware often propagates as executable attachments. The net effect is that many email systems simply block emails that contain them. Even if you had been able to attach your ".exe" file, it's extremely likely that your recipient's email program may have prevented him from being able to access it.

Forcing you to jump through a few hoops to send the file as something that is not immediately executable forces your recipient to have to take extra steps to actually run the program. They can safely adhere to the "never, ever, run executable attachments" rule, while still being able to accept executable files from you.

And they're forced to think about it before they just run whatever they receive.

Finally, I do have to add that because of malware and the general advice to not open any attachments, even from people you do trust (due to email account theft and hijacking) - you might just want to consider an alternate approach to getting an executable file from point A to point B on the internet. Perhaps using one of the several services, like DropBox, which allows you to share files securely and privately.

Article C4853 - June 22, 2011 « »

Share this article with your friends:

Share this article on Facebook Tweet this article Email a link to this article
Leo Leo A. Notenboom has been playing with computers since he was required to take a programming class in 1976. An 18 year career as a programmer at Microsoft soon followed. After "retiring" in 2001, Leo started Ask Leo! in 2003 as a place for answers to common computer and technical questions. More about Leo.

Not what you needed?

12 Comments
Roy Hill
June 28, 2011 10:28 AM

This would have been very useful when I lost spoolsv.exe from my task manager files. I re -formatted my computer with a loss of some files. The ones I lost haven't been noticed as they weren't used much.
I requested help from Micro Soft, but the information I got was the same from everybody.
This would have solved the problem.
Thank You very much
Roy

sirpaul2
June 28, 2011 11:24 AM

Here's the ones I know about for G-mail: "ade", "ade", "adp", "bat", "chm", "cmd", "com", "cpl", "crt", "exe", "hlp", "hta", "inf", "ins", "isp", "jse", "lib", "lnk", "mdb", "mde", "ms", "msc", "msi", "msp", "mst", "pcd", "pif", "reg", "scr", "sct", "shb", "shs", "sys", "vb", "vbe", "vbs", "vxd", "wsc", "wsf", "wsh".

G-mail will also 'bounce' corrupted files, no matter what the extension is.

MS-DOS Guru
June 28, 2011 5:10 PM

Password protecting the zip file will do the trick as well :)

Actually, it may not. Password protecting the zip doesn't hide the list of files contained in the zip, and if Gmail uses the filename only, then it has what it need to determine that there's a .exe in it - passworded or not. (Though I could be wrong and passwording might be considered something that makes it safer to Gmail.)
Leo
28-Jun-2011

Peter
June 29, 2011 5:19 AM

sometimes it works to copy the exe or other file into a word document and then sending the doc as an attchement.

Gerhard Nell
June 29, 2011 3:20 PM

This is an issue many struggle with , Especially how to uncompress an archive , The changing of the extension is the best way as its easy to explain in an e-mail. Many people do not know about zip and rar archives as they usually require a separate app to decompress an archive . Thanks Leo for explaining this topic so well, I will point people to this article .

johnpro2
June 30, 2011 3:14 AM

@ask leo. "Finally, I do have to add that because of malware and the general advice to not open any attachments, even from people you do trust "

Me:If you open within a sandbox ..no harm will be done even if the attachment is infected .After you close the sandbox everything is safely deleted.
Jp

Glenn P.
July 5, 2011 10:03 AM

Leo, you wrote:

"Actually, it may not. Password protecting the zip doesn't hide the list of files contained in the zip, and if Gmail uses the filename only, then it has what it need to determine that there's a .exe in it - passworded or not."

Indeed: zipfiles list their contents in a header which serves as a "table of contents" which isn't necessarily encrypted.

If this proves to be an issue, first unencrypt the zipfile if it was encrypted (since encrypting it didn't hide the filenames) and rezip it unencrypted. (If it wasn't encrypted to begin with, then obviously there's no need to rezip.)

Next, zip the first zipfile inside a second, encrypted  zipfile. This second zipfile should  encrypt everything within it, this time including  the filenames within the first zipfile, which aren't a "table of contents" anymore, but are now simply file data.

A lot of trouble, I know -- but it should work...!

Ed B.
July 19, 2011 8:20 AM

Yes Leo, I have used the rename for years on gmail. I always rename to *.jpg. You just need to inform the other person if it is an .exe, .zip etc.

Great minds think alike. :)

Jeff J
March 18, 2012 10:09 AM

This alone is reason for me to abandon my gmail account. As more and more programming is devoted to non-advanced computer users, I find the nanny-ism and "convenience" features to be really bothersome.

Rashid Mehood
May 1, 2012 7:01 PM

we can send exe files by using winrar instead of winzip or sending them without compression.

Rashid {URL removed}

ddi
October 12, 2012 2:15 PM

No one of above mention methods are not usable with gmail today.
Only way to send any .exe file is to split them into at least two parts. You can use winrar to make splitted archive files!

Cheers ;)

Mike
December 21, 2012 7:45 PM

It is possible to legally send exe's and bat files within a jpg, without notifying the recipient. Just google it.

Comments on this entry are closed.

If you have a question, start by using the search box up at the top of the page - there's a very good chance that your question has already been answered on Ask Leo!.

If you don't find your answer, head out to http://askleo.com/ask to ask your question.