Home WebServer PanelDirectAdmin How to configure SMTP Relay on DirectAdmin

How to configure SMTP Relay on DirectAdmin

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

What is Mail Relay?

Email Relay is defined as follows:

  • Email is electronic mail.
  • Relay is forward.

To make it easier to imagine, Email Relay is an email forwarding service. Email Relay, or SMTP Relay, is a service allowing others to use a linked email program. You can use your Email Server to send the email (this person may not have a mail account in your mail server)

Configure SMTP Relay on DirectAdmin

Step 1: Register and set up Mail Relay

There are many reputable Mail Relay providers. I choose smtp2go to register for this tutorial’s free mail relay service. In this free plan, you will get:

  • 5 domain
  • 1.000 mails/month

And to register, you can access the home page of smtp2go, create an account and use it.

When the account has been activated, select Settings => Sender Domains => Add Domain => Enter the domain and select Continue with this domain

You will get DNS configuration information as below. Copy these CNAME records and then configure them on the DNS domain server. Now you go back to the settings of smtp2go and select Verify, if it shows ✅ in these records is complete.

Configure SMTP Relay on DirectAdmin

Step 2: Create an SMTP account

Next, create an SMTP User account to configure the following steps. You click Settings => SMTP Users => Add SMTP user

Configure SMTP Relay on DirectAdmin

On this screen, you enter the following information:

  • Username: Set a name for the user
  • Password: Set a password for the user
  • Description: Enter a description or leave it blank

Then click Add SMTP User to complete.

anh 109

After completing the steps to set up an SMTP Relay account, you will have the information below. And you need to save this information to serve the configuration in Step 3.

  • SMTP User: 100.smtp2go
  • Password User: EJYovYgCV3Bcsfy8
  • SMTP Server: mail.smtp2go.com
  • SMTP Port: 2525

Step 3: Configure SMTP Relay on DirectAdmin

To configure, you first need to SSH into the DirectAdmin server. If you don’t know how to SSH, you can refer to the following article:

After SSH into the DirectAdmin server, please do the following configuration part by part:

  • Configure Manualroute Router

Manualroute Router provides a way to route an address by domain manually. It is mainly used when you want to route an address to a remote server according to your own rules, bypassing the usual DNS routing that looks for MX records.

Route outgoing mail via Relay SMTP in /etc/exim.routers.pre.conf

vi /etc/exim.routers.pre.conf

Next, enter the following content into the file:

spamgateway_smarthost_router:
 driver = manualroute
 domains = ! +local_domains
 ignore_target_hosts = 127.0.0.0/8
 condition = "${perl{check_limits}}"
 transport = smarthost_smtp
 self = send
 #route_list = $domain [enter IP hor hostname SMTP]::587
 route_list = $domain mail.smtp2go.com::587
 no_more
  • Configure SMTP Transports

SMTP Transport sends messages via TCP/IP connections using the SMTP or LMTP protocols.

Next, create a gateway for SMTP Relay.

vi /etc/exim.transports.pre.conf

Then enter the following content:

smarthost_smtp:
 driver = smtp
 #port = [enter the SMTP port]
 port = 587
 hosts_require_tls = *
 hosts_try_auth = smarthost_login
 hosts_require_auth = *
  • Configure Authenticator

Authenticator will be responsible for authenticating information to the SMTP Relay Server.

To configure, create authenticators in /etc/exim.authenticators.post.conf

vi /etc/exim.authenticators.post.conf
smarthost_login:
 driver = plaintext
 public_name = LOGIN
 #client_send = : smtp_username : smtp_password
 client_send = : 100.smtp2go : gzw2Dg1VlfsmPzEr
  • Restart the Mail Server service
systemctl restart exim

Step 4: Send email to check

Now compose an email under the domain that you configured the authentication in Step 1 and you can see the main log for follow up.

tail -f /var/log/exim/mainlog
anh 106

The result after configuring the mail was 99% sent to the inbox of Gmail.

CleanShot 2022 05 15 at 18.59.48

At the same time SPF, DKIM, DMARC are all PASS. This helps your email become more reputable.

CleanShot 2022 05 15 at 19.00.06

In addition, if you check the mail header, you will see that Received here all go through the Mail Relay server.

CleanShot 2022 05 15 at 19.00.25

So AZDIGI has completed the instructions for configuring SMTP Relay on DirectAdmin. Hopefully, this article will help you configure it successfully and without problems.

You can refer to other instructions at the link below:

If you need support, you can contact support in the ways below:

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign