2011/12/21

Send emails with attachment, from the command line, using the default email client

How to send email with attachments in a way programmed and automated by using the default e-mail client software whatever it is (Outlook, Outlook Express, Windows Live Mail, Thunderbird, etc.).?

Essentially there is the need to have a system to compose an email message containing: sender, recipient, title, subject and attachment files and to automatically open the default email client with the message pre-compiled so that the user has to carry only sending.
There are at least a couple of methods:

1. MAILTO
You can use the command mailto with the attachment parameter:
From a command prompt (click Start | Run, then type cmd and press enter) you can launch the default email client through a mailto hyperlink.
Please note that NOT all Email Clients support the parameter for attachments (such as Thunderbird does not accept it).
mailto:me@example.com?Subject=Hi&Body=See+attached+file&Attach="C:\readme.pdf" 

2. SENDTOVB
"Programmatically send emails with attachments using the default email client"
You can use the tool SendToVB, a small free command line utility software that allows you to send email with attachments by a programmed way using the default email client! 
SendToVb is compatible with ALL Client (Thunderbird included). Here is the screen that summarizes the commands and options available:
SendToVB command and options available

You can use the software with Windows command prompt.
The syntax is simple:
SendToVB -files <attachment file1> -body <text of mail> -to <email address> -subject <content>

Example:
SendToVB -file c:\readme.txt -body "Hello here the document for you" -to marc@example.com -subject "Important"

The commands (flags) are:
-files <file1>... <fileN> with which you can send multiple attachments in the same email.
-body <text> which is part of the body of the message enclosed in double quotes (").
-bodytext <bofyfile.txt> that can be used as an alternative to -body when the email must contain a very long message. It allows you to specify the text file that contains the body of the email.
-to <address1>; <address2> with which you can also specify multiple recipients separated by a semicolon (;)
-cc <address1>; <address2> with which one can point in Carbon Copy also multiple recipients separated by a semicolon (;)
-bcc <address1>; <address2> with which one can point in Blind Carbon Copy  even multiple recipients separated by a semicolon (;)
-subject <text> with which you assign the title of the email
-mailto with which to force SendToVB to use the mailto method (instead of the MAPI functions) but that may not work properly when inserting attachments!
All commands (flags) can be abbreviated with the first letter, eg -subject becomes -s


In addition, for those who experience problems with too many parameters and receive the message "command line too long" you can use a second method:

-list <listfile.txt> indicates where the text file that contains a single line with all specified commands to be used for sending mail

SendToVb automatically open your Default Email Client (for example Thunderbird) and compose the email like in Window.

Notes for software developers:

a. Since SendToVB is a small stand-alone tool, it can also be used by third-party software to automate the procedures for sending mail. A hypothetical third-party software written in Visual Basic. NET or C# might contain within it a line of code that calls a shell command within the SendToVB.

For example:
System.Diagnostics.Process.Start ("SendToVB -to you@example.com -file C:\readme.txt");


b. SendToVB is coded in Visual Basic 2005 and requires the installation of .NET Framework 2.0 runtime which is often already installed on new PCs. Internally it automatically uses MAPI functions when it has to send emails with attachments, and use the command mailto to send email without attachments.

Notes from the Author:

CHANGELOG:
Version 1.2 - Added -cc and -bcc parameters
Version 1.1 - The First !


Buy Me a Coffee at ko-fi.com

2011/10/12

E-Virus (Part III): I have a PC infected! Now as I clean it?

After confirming the presence of one or more e-virus on your PC,



... you should read up as much as possible about the characteristics of those viruses that are present (mode of distribution, payload, removal instructions). If you know your enemy it's easier to defeat him! 


In fact, if you know the name of the virus and how it is dangerous, it is possible to find a specific removal tool freely available from software companies like: Symantec, Kaspersky, McAfee, TrendMicro, etc.. 
For example, there are removal tools for the most common viruses such as: Melissa , Bagle , MyDoom, Sasser , Conficker, Zeus, etc.. 

Otherwise, you can use tools to remove general (broad spectrum) such as:
Obviously you can increase the benefits of these products by performing sequentially scanning of the PC by the use of different tools. 

Sometimes however, you might need to do multiple scans with different products but you can not install too many anti-virus simultaneously on the same PC due to speed and compatibility issues. Besides, the sequential installation and removal of different antivirus is a costly and long process, but you can avoid this using free online tools for virus scan and removal offered by some software companies (the only constraint is need to be online to scan).
Here there are some examples of online malware removal tools:
Of course, all these operations are feasible if the virus has not completely compromised  the access to your PC.

If you can't start the operating system then you can use antivirus software from a CD or bootable USB key (Rescue CD). These systems are typically available as .ISO images and you must create a CD / DVD or install it on bootable USB sticks, so you can operate apart from the operating system (Windows / Linux) that is installed on the infected PC . You have only to carefully verify that the BIOS first boot device is selected to the CD or USB external drive.
Some available tools are:
9) COMODO Rescue Disk CD
Once you start the CD you can scan the hard drive and require the deletion / correction of the infected files.

PERSONAL EXPERIENCE:
I have often used some of these tools along with excellent results. In particular ComboFix has been decisive with the most "insidious" viruses
Regarding the now infamous "worm" Conficker - Downadup, I can indicate the presence of specific free removal tools from almost all antivirus manufacturers. Among these however Bitdefender provides also a free removal tool that works on the whole LAN and not only on the individual PC ( Network Downadup Removal Tool ). 
Sometimes even after the virus removal, the operating system is "unstable" because it is partly damaged by the virus itself. In these cases a viable technique, apart from the total re-installation of the O.S., is to go back the System Restore a few days before the virus infection (feature available from Windows XP ).