N
N
Nikolai Litinsky2018-11-20 02:39:25
JavaScript
Nikolai Litinsky, 2018-11-20 02:39:25

How to modify bash script to send mail?

Hello,
I need help writing a bash script to send e-mails. I'm not very good at this yet, and I didn't really find the right example on the Internet.
The task is to write a script that will send e-mails to the addresses specified in txt, the content will also be taken from txt, but different. And there is something else written about the fact that the list of local users should be obtained using the enumeration of the contents of the system directory var/spool/
mail suitable for my case:

#!/bin/bash
# Будет отображаться "От кого"
[email protected]
# Кому
[email protected]
# Тема письма
NAME=$1
# Тело письма
BODY=$2
# В моем примере я отправляю письма через существующий почтовый ящик на gmail.com 
# Скрипт легко адаптируется для любых почтовых серверов
SMTPSERVER=smtp.gmail.com
# Логин и пароль от учетной записи gmail.com
[email protected]
SMTPPASS=superpassword

# Отправляем письмо
/usr/bin/sendEmail -f $FROM -t $MAILTO -o message-charset=utf-8  -u $NAME -m $BODY -s $SMTPSERVER -o tls=yes -xu $SMTPLOGIN -xp $SMTPPASS

I would be very grateful for your help on this matter.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Zuev, 2015-11-15
@booogabooo

I suggest
Slider is rigidly tied to animationName. And it is tied to the animation of the .da-img element, but you don’t have it.
You need to either provide this element or tweak the slider code to fit your animations in the animationend event .

if( event.originalEvent.animationName === 'toRightAnim4' ...

P
pfg21, 2018-11-20
@pfg21

Change the lines to
KEY=`cat /path/to/file`
`` - execute the command and "throw the result into the script".
I studied the use of quotes in the bash, there are a lot of cool subtleties.

N
Nikolay Litinsky, 2018-11-22
@Nicornix

I remade this script using those slash quotes, but it gives the following errors on startup:
I'm currently using Linux as a subsystem on Windows 10, maybe because of this it gives a path error?
And for this, smtp needs an additional library to connect / install to Linux?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question