Skip to main content

Send executable file as attachment through email

Gmail, Yahoo Mail, or many other free email service providers normally don’t allow us to attach an executable (.exe) file with the email and send or receive them across the internet. We normally get such type of error while sending executable as attachment “xxx.exe contains an executable file. For security reasons, Gmail does not allow you to send this type of file”.

Due to security threats (like virus, worms, trojans or bots) email anti virus scanners employed by email service providers, all emails and their attachments are scanned and each and every type of executable is barred from getting send or receive through email.

Thus, we cannot send or receive any type of executable such as exe, dll, com, bat, etc through emails. Even if we try to send any executable by zipping it using any archiving tool (zip, tar, tgz, taz, z, gz), we cannot send or receive emails.

But here is the way out, well through minor tweaks we can still send executable attachments through email :
  1. If there is only one executable that you want to send, then just rename the extension of the executable file from say “xxx.exe” to something like “xxx” or “xxx.ex”. Now attach this renamed file with the mail and send it. Email scanners will not be able to detect it as executable and thus it can be easily sent across the internet through email. At the recipient’s end after downloading the attachment we just need to rename it back to its original name i.e. from “xxx” or “xxx.ex” to “xxx.exe”.
  2. If there are two or more executable to be sent through email or if you want to send two or more files (in which few of them are executable) through email then here are the two ways :
  • First zip them using any archiving tool you have like zip, tar, tgz, taz, z or gz then rename the archived file lets say from “” to something like “xxx” or “xxx.zi”, attach it to the email and send it. Email scanners cannot recognize renamed archive file and treat it like a single file thus it will be easily sent across the internet through email. At the recipient side, download the attachment and rename it back to its original name.
  • If you want to bypass this headache of renaming files then just archive the file with an encryption option and lock it with a security password. Encryption feature of archiving tools uses industry standard encryption algorithms and thus email scanners won’t be able to scan your attachment as they don’t have the password to open it. So attach this encrypted archive file with the mail and send it across the internet through email. Please note : do mention the security password used to lock the archive in the mail otherwise recipient will not be able to unzip the file.
  • There is one more easier way to send the archive through email. Just zip them using a “Winrar” or any other “.rar” archiving tool. Archive in “.rar” format is not recognized by the email scanners as an archive thus email scanners treat it as a single file and thus it can be easily attached and sent across through email. Please note : recipient also need some “.rar” archive tool to unzip the file.
Happy Emailing!!!


Popular posts from this blog

JUnit – Run unit test in an Sequence / Order

In JUnit, we can use @FixMethodOrder( to run the test methods in a sequence or order.

import org.junit.FixMethodOrder;import org.junit.Test;import org.junit.runners.MethodSorters;importstatic;importstatic org.junit.Assert.assertThat;//Sorts by method name@FixMethodOrder(MethodSorters.NAME_ASCENDING)publicclassExecutionOrderTest{@TestpublicvoidtestB(){assertThat(1+1,is(2));}@Testpublicvoidtest1(){assertThat(1+1,is(2));}@TestpublicvoidtestA

Create Runnable Jar - Eclipse Options

When exporting to a Runnable Jar, there are three options in eclipse Helios. Extract required libraries into JARPackage required libraries into JARCopy required libraries into sub folder next to JAR. What are differences : Extract required libraries into JAR - Extracts the actual .class files from the libraries your app uses and puts those .class files inside the runnable JAR. So, the runnable JAR will not only contain the .class files of your application, but also the .class files of all the libraries your application uses. Package required libraries into JAR - Puts the actual JAR files of the libraries into your runnable JAR. Normally, a JAR file within a JAR file cannot be loaded by the JVM. But Eclipse adds special classes to the runnable JAR to make this possible. Copy required libraries into sub folder next to JAR - Keeps the library JARs completely separate from the runnable JAR, so the runnable JAR will only contain the .class files of your application. Option #2 is convenient be…