Using smarthost to send local mail to external accounts

While blog creation I meet  a requirement to send mails from server which runs this blog to outside for registration and other purposes.

Not to forget that I made this post. Feature called Smarthost.

I run debian 6.0.5 with default Exim MTA and think of using gmail as smarthost account.

# dpkg-reconfigure exim4-config

  • set “mail sent by smarthost; received via SMTP or fetchmail”
  • set outgoing smarthost to “smtp.gmail.com::587” (notice double colon)

other settings may be default

then need to specify:

# vi /etc/exim4/passwd.client

*.google.com:Credentials@gmail.com:Passwd

run following after that:

# chown root:Debian-exim /etc/exim4/passwd.client && chmod 640 /etc/exim4/passwd.client

# echo ‘LoginAcc:  Credentials@gmail.com ‘ >> /etc/email-addresses

# update-exim4.conf && invoke-rc.d exim4 restart && exim4 -qff

see the logs if something is wrong:

 /var/log/exim4/mainlog 

 /var/log/exim4/paniclog

Create a forward file  for forwaring all local email to predefined account.

# echo   Credentials@gmail.com > ~LoginAcc/.forward

test sending e-mail

 $ mail -s “test message” LoginAcc < /dev/null

External sources used: http://wiki.debian.org/GmailAndExim4

This entry was posted in Administration, Linux/Unix and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *