This script is very generic and can be used anywhere to send an authenticated email. The email is also secure because it creates a STARTTLS
session making sure no one can snoop in (except NSA I guess). Also it has a logging capability which logs errors and exceptions in /var/log/syslog
but then the script has to be executed with root privileges. Obviously this can be changed and logging can be enabled in any other file if running as a root in not an option. Script is pretty much self explanatory but feel free to ask if you have any questions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
Just to extrapolate, this script can be called from another script where there is a requirement to send an authenticated and encrypted email. This can be done by calling the sendemail
function from the authmail script. I have successfully tested this script with Gmail.
1 2 3 4 5 6 7 8 9 10 11 |
|
This and other scripts can be checked at my github page.