FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
258 views 0 comments
by
Hello !

I would like to add this command as a custom script :

echo "Router was restarted" | mail -s "Restart" jonhny@gmail.com

How to do this ? As I checked, "mail" command is unavaible.

Best,

Adam

1 Answer

0 votes
by anonymous

Hi,

There's a command that you could use with emails, I'll put it here in the form of the script file.

#!/bin/sh

echo -e "subject:test\nfrom:testmail@gmail.com\n\ntestestestestest" | sendmail -v -H "exec openssl s_client -quiet -connect smtp.gmail.com:587 -tls1 -starttls smtp" -f testmail@gmail.com -au"testmail@gmail.com" -ap"lalalal" recipient@gmail.com

Just make sure you have third-party app access and other SMTP settings enabled in Gmail before executing this with your emails.

EB.