Link to home
Start Free TrialLog in
Avatar of phil2_curtis
phil2_curtis

asked on

Send an email with attachments from the command line

How can I send and email with file attachments from the command line.

Thanks Phil.
Avatar of jnbkze
jnbkze
Flag of Afghanistan image

you can do something like this:

$ uuencode my_attachment a_new_file_name | mail -s "this is the subject" me@mymail.com

This will send me@mymail.com an email with an attachment called a_new_file_name

Hope this helps
Avatar of dorward
dorward

You can use the mutt email client.

mutt email@ddress -a filename.to.attache -s "Subject of email" < file.containing.message.body

or

Another program that produces output that you want as the message body | mutt email@ddress -a filename.to.attache -s "Subject of email"

mail whoever@wherever.com -s "hello there" < attachment
Isn't 'mail whoever@wherever.com -s "hello there" < attachment' only suitable for plain text attachments?
ASKER CERTIFIED SOLUTION
Avatar of moonbeam012200
moonbeam012200

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
*ping*
I'm still here. Happy thanksgiving!
Avatar of phil2_curtis

ASKER

I will give you the points, even though I didn't use your example. My solution was along the same lines and that was to write my own program to do the task.

Phil
Compliments to the moonbeam chef. It worked like a charm!