Simple Debian/Gmail configuration for sending mail from CLI

Sometimes we need to use the mail command (instead of a rich MUA) . A central mail server is not always available and there may be a need for simpler solutions. This article demonstrate a direct link from exim4 (Debian/Squeeze) to Gmail.

Directions

  • On a newly installed Debian, type :
    # dpkg-reconfigure exim4-config
  • Choose “mail sent by smarthost; no local mail
  • Choose all default values until the “smarthost” configuration
  • “Smarthost” is smtp.gmail.com::587
  • Edit the password file:
    # vim /etc/exim4/passwd.client
  • Add a line like this one:
    *.google.com:[your-gmailusername]@gmail.com:[your-gmailpasswd]
  • Run : # update-exim4.conf
  • Test the mail command

References

Debian wiki
Debian documentation
Another guide on the subject

2 thoughts on “Simple Debian/Gmail configuration for sending mail from CLI”

  1. I prefer giving the pattern with [] for parameters instead of notes for command when i write these types of posts. It clearly marks all you have to change from the example to apply the command.

    *.google.com:[your-gmail-username]@gmail.com:[your-gmail-password]

Comments are closed.