Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a png file embedded in a mail via command line on linux?

I was trying to send a png file in a body of an email via command line. I have been using the following command:

uuencode file.png file.png| mail [email protected]

but it attaches the file in the mail, rather than embedding it in body. Could you please tell me how to send mail with png file embedded in mail ?

Thanks.

like image 701
Rahul Gupta Avatar asked Nov 04 '22 10:11

Rahul Gupta


1 Answers

You want to create a mime HTML email a la:

How to embed images in email

Then take the headers (all the lines before the first boundary), remove them from that input and add them individually with the -a command after mail such as:

https://stackoverflow.com/a/12262421/2244213

like image 75
Bigfootmech Avatar answered Nov 09 '22 12:11

Bigfootmech