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.
much simpler:
mail -s “subject” -a “filename”
mailx [-BDdFintv~] [-R address ] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . .
why so complicated?
mutt -s subject -a file1 -a file2 receivert@example.com
You can also use mail , e.g. :
# mail -a filename -s “you subject” mail@mail.com
kmail –attach -s foo@bar.org does it too.
howzit folks?
these tips are helpful but what i’ve been struggling with is trying to send spam email as an attachment to spamcop within kmail using the filter actions. Does anyone have any bright ideas to do this?
cheers
aztrix