Quantcast
Channel: Manfaat Sehat
Viewing all articles
Browse latest Browse all 61

Installing Exim4 on Red Hat and CentOS and setting up GMail Relay

$
0
0
Exim4 is my favorite email transport software; it's rather easy to use (especially on Debian) and has far more simple setups than Sendmail.

On Red Hat Enterprise Linux 6 (RHEL6) and CentOS 6, installing Exim4 is easy as well.  First install the app and then set it as our main MTA:

  root-shell#  yum install exim
  root-shell#  alternatives --config mta 



Then we set Exim to start at boot and we start it up now, and turning off the others:

  root-shell#  chkconfig sendmail off
  root-shell#  chkconfig postfix off
  root-shell#  chkconfig exim on
  root-shell#  /etc/init.d/sendmail stop
  root-shell#  /etc/init.d/postfix stop
  root-shell#  /etc/init.d/exim start



We can also set it up to relay via GMail by editing /etc/exim/exim.conf to make a few changes.  We turn off the 'DNS Lookups' section by adding the pound sign, and remove that sign from the 'Remote SMTP' section.  Edit that 'remote_smtp' to read 'remote_msa'.  When done it should look like this:

  #dnslookup:
  #  driver = dnslookup
  #  domains = ! +local_domains
  #  transport = remote_smtp
  #  ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
  #  no_more

  smarthost:
    driver = manualroute
    domains = ! +local_domains
    transport = remote_msa
    route_data = smtp.gmail.com
    no_more




Find the 'begin transports' section and edit the 'remote_msa' to look like this, including adding this last line:

  remote_msa:
    driver = smtp
    port = 587
    hosts_require_auth = $host_address
    hosts_require_tls = $host_address



Head towards the bottom of the file and add this section in the 'begin authenticators' section:

  begin authenticators
 
  gmail_login:
    driver = plaintext
    public_name = LOGIN
    hide client_send = : YourEmail@gmail.com : Pa5sW0Rd



Restart Exim and send a test email:

  root-shell#  /etc/init.d/exim stop
  root-shell#  /etc/init.d/exim start
  root-shell#  echo "test email" |mail -s youremail@gmail.com
  root-shell#  mailq



Your email should be delivered.  If not, you may be blocked from sending on port 587 or you may have your user or pass incorrect.   Thanks to PhilRoss for the tips.  Please leave comments if this was helpful!

Debian and Ubuntu instrucrtions can be found here.

Viewing all articles
Browse latest Browse all 61

Trending Articles