📜 ⬆️ ⬇️

Linux: Sending mail from the console

After the New Year holidays there were a lot of photos, some of which I decided to share with a friend. I decided to transfer files by electric mail.
Photos were pre-prepared. After that, the first part was sent via the gmail web interface (there are no email clients on the computer). I immediately wanted to optimize this process ... In fact, it is necessary to send several letters, filling in several identical fields and attaching a bunch of different files.
Googling a little small script was found that completely matched my tasks. Gentoo is present in ports, so we install from ports:

emerge -av net-mail/sendEmail

After installation, proceed to the study of the built-in help. A quick inspection reveals that in my case it is necessary to run a script with the following keys:

sendEmail -f from_mail@gmail.com -t to_mail@mail.ru -o message-charset=utf-8 -u "Photos..." \
-m " ..." -s smtp.gmail.com -xu from_mail@gmail.com -xp PASSWORD \
-l log_file.txt -a photo_1.jpeg photo_2.jpeg


-f from_mail@gmail.com - from which soap we send mail
-t to_mail@mail.ru - to whom we send letters
-o - additional options, for example, the encoding of the message.
-u "Photos ..." is a soap theme.
-s smtp.gmail.com - mail sending server
-xu from_mail -xp PASSWORD - login password of your mail
-l log_file.txt - where we write logs.
-a - attachments

')

Source: https://habr.com/ru/post/80279/


All Articles