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.


  • 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
  • Edit the password file:
    # vim /etc/exim4/passwd.client
  • Add a line like this one:
  • Run : # update-exim4.conf
  • Test the mail command


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.


Comments are closed.