Archief: Dit artikel is oorspronkelijk in het Nederlands geschreven en maakt deel uit van mijn archief. De informatie kan verouderd zijn.

Versturen van mail vanaf de NSLU2

December 9, 2008 min read Archived

Om mail te versturen, moeten de volgende ipkg’s geinstalleerd worden:

$ ipkg install ssmtp  
$ ipkg install nail

In /etc/ssmtp/ssmtp.conf moet het volgende geconfigureerd worden:

#  
# /etc/ssmtp/ssmtp.conf -- a config file for sSMTP sendmail.  
#  
# The person who gets all mail for userids < 1000  
root=postmaster  
# The place where the mail goes. The actual machine name is required  
# no MX records are consulted. Commonly mailhosts are named mail.domain.com  
# The example will fit if you are in domain.com and you mailhub is so named.  
mailhub=smtp.xs4all.nl
# Where will the mail seem to come from?  
#rewriteDomain=localhost.localdomain  
# The full hostname  
hostname=xs4all.nl
# Optioneel de loginname/paswoord voor de provider  
# authuser=arjan  
# authpass=geheim  

In /etc/ssmtp/revaliases moet het volgende geconfigureerd worden:

# sSMTP aliases  
#  
# Format: local_account:outgoing_address:mailhub  
#  
# Example: root:your_login@your.domain:mailhub.your.domain[:port]  
# where [:port] is an optional port number that defaults to 25.  
root:arjan@gmail.com:smtp.xs4all.nl

Nail gaf bij mij een foutmelding dat /usr/lib/sendmail niet gevonden kon worden. Dit heb ik opgelost door het een link naar /usr/bin/ssmtp te plaatsen:

$ cd /usr/lib  
$ ln -s /usr/bin/ssmtp sendmail

Nu kan een mail verstuurd worden door een handig scriptje te maken:

if [ -z $2 ]; then  
 echo "Alleen een subject meegegeven." | nail -s "$(hostname): $1" arjan@gmail.com  
else  
 cat $2 | nail -s "$(hostname): $1" arjan@gmail.com  
fi