I configured my local mail system to use the gmail SMTP server.
Install package ssmtp and configure /etc/ssmtp/ssmtp.conf with following parameters:
root=postmaster AuthUser=kdguntu@gmail.com AuthPass=NoWAYiWILLtellYOUmypassWORD FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES hostname=defaults.be |
This scripts reads an input file (listusers.txt) with ; seperated values for example containing lines like this:
mathilde.dudekem@hotmail.com;Mathilde;team1 filip.frombelgium@yahoo.com;Filip;team2
Since it might be dangerous running this spam machine with any kind of inputfile, this script does not send mails, but creates a mailscript.
INPUT="listusers.txt" M="mailscript.sh" echo '#!/bin/bash' > $M SUBJECT="Your teamserver is ready" OLDIFS=$IFS IFS=";" [ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; } while read EMAIL NAME TEAM do echo "mail -s \"$SUBJECT\" \"$EMAIL\" <<EOM ">>$M echo 'Dear $NAME,'>>$M echo 'Your server is available at: '>>$M echo "https://defaults.be/$TEAM ">>$M echo ' ' >>$M echo 'Kind Regards'>>$M echo ' ' >>$M echo 'Kdguntu'>>$M echo 'EOM'>>$M echo " echo $EMAIL sent " >> $M echo "sleep 1" >> $M done < $INPUT IFS=$OLDIFS chmod +x $M |