Nota Acap
  • Introduction
  • Linux Guide
    • Fresh Installed Centos 7
    • Changing Network Interfaces in Centos 7
    • Lockdown SSH
    • Recursively change permission Linux
    • Proxy Server IPtables
    • Provisioning Web Server with Custombuild
    • MySQL Basic Management
    • Increasing Existing LVM Disk
  • Windows Guide
  • Application Guide
    • WEB Port IPtables Rate Limit
    • Simple Email Piping Script
    • HTTP Dead
    • Email Relay Outgoing
    • Compiling Extra PHP version (Directadmin)
    • Finding the SPAM (cPanel)
    • HTTP Basic Virtual Host
    • Update Kernel for DRBD Hosts
  • Migration Related
    • Cpanel -> Cpanel (Bulk)
    • IMAPSYNC Basic Scripts
    • Directadmin -> cPanel (Copy/Sync Emails)
    • Basic Rsync Script
Powered by GitBook
On this page

Was this helpful?

  1. Application Guide

Email Relay Outgoing

Creating Mail Relay Authenticated By IP (Outgoing)

I used Centos 6.8 to configure a Mail Relay.

1st step -

Install exim in your server :

yum install exim-mysql -y

Usually centos default MTA is postfix, so we need to change the default MTA to exim, with command below :

alternatives --config mta

It will bring you below selection :

There are 2 programs which provide 'mta'.

Selection Command
-----------------------------------------------
* 1 /usr/sbin/sendmail.postfix
+ 2 /usr/sbin/sendmail.exim

Enter to keep the current selection[+], or type selection number:

Choose 2 to use exim as the default MTA, (I have chosen 2 in my example).

service postfix stop
chkconfig postfix off
service exim start
chkconfig exim on

Now we need to change the exim configuration at /etc/exim/exim.conf

Change to below :

primary_hostname = acaprelay.amirulasyraf.com <- my mail relay hostname
hostlist relay_from_hosts = 127.0.0.3 : (add your mail server IP here) <- to make sure that you are allowed to relay in this server

Then find a section called "router" in the configuration and make sure the router is set as below :

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

Above config will tell route all email, and send it for you to the recipient.

But we must make sure that your mail server know where to relay the server to, so you need to login to your mail server (origin server).

Then edit the exim config for smarthost as below :

smarthost:
 driver = manualroute
 domains = ! +local_domains
 transport = remote_smtp
 route_list = * acaprelay.amirulasyraf.com    <- this will guide my mail server to relay email to my new Mail Relay Server
 no_more
 no_verify

After completed all above steps, try to send using your origin server to anyone.You will got the header of the email as below :

Return-Path: aberu@amirulasyraf.com
Received: from *.*.*.*(LHLO ips1-mail.ipserverone.com) (*.*.*.*) by
 ips1-mail.ipserverone.com with LMTP; Fri, 6 Jan 2017 10:55:17 +0800 (MYT)
Received: from barracuda.ipserverone.com (mail.as2.ipserverone.com [*.*.*.*])
	by ips1-mail.ipserverone.com (Postfix) with ESMTP id 7EFE4516966A
	for <asyraf@ipserverone.com>; Fri,  6 Jan 2017 10:55:17 +0800 (MYT)
X-ASG-Debug-ID: 1483671316-068b3e1093354110001-4XlEqv
Received: from acaprelay.amirulasyraf.com ([*.*.*.*]) by barracuda.ipserverone.com with ESMTP id OFtS3gY6HqFmSdZT for <asyraf@ipserverone.com>; Fri, 06 Jan 2017 10:55:16 +0800 (MYT)
X-Barracuda-Envelope-From: aberu@amirulasyraf.com
X-Barracuda-Apparent-Source-IP: *.*.*.*
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=amirulasyraf.com; s=mail;
	h=Message-ID:From:Date:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:To; bh=1bP+QR4oOJI80qfwgQhGi2RMJffC7P++shP6eV7AOkU=;
	b=A01VatqmaxW7vdK620CspLLO/c3D9QzeFoO8+1YZT2JlUxPXNzRNfT44p7i6Rzf+z8DUckDiyAun1mOjGJxGcm8Q9WryiJB4RQ/SIVdl2pOcZ1zNQ+OzPH9YMfFBklSZ4PbELCi+6TjF110YPu99sz7x0053AJyS8tFPLjwUH3A=;
To: asyraf@ipserverone.com
Subject: Test
PreviousHTTP DeadNextCompiling Extra PHP version (Directadmin)

Last updated 6 years ago

Was this helpful?

As you can see above, it stated that it received from my Mail Relay ().

acaprelay.amirulasyraf.com