Oct 232010

This is a quick tip for all those beginers on openSUSE, SUSE Linux or even for that matter on any Linux or Unix distros on how to send an email from command line with an attachment. This could be a text or an image file.
By default, mail messages can be encoded with the file content into the mail message body rather than adding the required file as an attachment. To send a file as an attachment use the “uuencode” utility as follows:
Annai~ # uuencode filename.png filename.png | mailx -s “mail subject” receiver@address.com
In the above, uuencode writes an encoded version of the file (filename.png here) which is then piped to the mailx command.
This ofcourse assumes, you have your system is configured to send emails. In openSUSE, SuSE linux, click here to know how to configure Postfix to send emails.