Monday, December 14, 2009

Send files by mail from unix command line

I find it usefull sending log files from linux/unix by mail, some times it is just for saving clicks instead of using ftp, and often as part of a script.
Of course that the server should be configured for that, usually it is enabled by default.

Sending attached file
uuencode original_file_name new_file_name | mailx -s "Subject" My.Mail@Mail.COM


Sending a file as text in the email body
mailx -s "Subject" My.Mail@Mail.COM < file_name

(if mailx does not exists -> just use mail)

No comments: