Nội dung
Some servers that use DirectAdmin with the CSF firewall may prevent you from sending emails via SMTP. In that case, you will need to enable SMTP on DirectAdmin in the CSF interface to be able to do so.
I. Introduction
In a previous article, AZDIGI showed how to install CSF on DirectAdmin. Since CSF is a free and relatively good software firewall, almost every VPS or server should install it.
However, after we install CSF, it will block sending emails via SMTP by default. So, if your website uses SMTP for email notification features such as:
- Email notification when customers fill out registration forms.
- Order and reservation notification.
Then it will certainly not work.
Therefore, in this article, I will help you enable SMTP on DirectAdmin when using the CSF firewall in two different ways:
- Through the CSF interface directly on DirectAdmin.
- Through the SSH protocol.
II. Enable SMTP on DirectAdmin
We will go through each method one by one.
Method 1: Through the CSF interface directly on DirectAdmin
I think you will prefer to use this method because it is much simpler than method 2. First, to enable SMTP on DirectAdmin using this method, we need to access the DirectAdmin interface with Admin privileges.
Then we access the Extra Feature category and select the ConfigServer Security & Firewall feature as shown below.
On the main ConfigServer Security & Firewall (CSF) interface, we scroll down a bit to find the CSF configuration section, which will be named Firewall Configuration.
In this interface, let’s use the quick move button as shown in the image below and select SMTP Settings.
Here, let’s adjust SMTP_BLOCK from On to Off.
Then we scroll down to the bottom of the page and select Change to save the new configuration.
Finally, CSF will report that your configuration has been saved. You will need to restart CSF to receive this new configuration. Select the Restart csf+lfd button to restart.
So we have successfully enabled SMTP on DirectAdmin through the CSF interface. You can try to check if your SMTP is working or not.
Method 2: Enable SMTP on DirectAdmin via SSH
In this method, we need to follow the following 3 steps.
Step 1: SSH into your server
To enable SMTP on DirectAdmin via SSH, first, we need to SSH or access your VPS or server as root. Or at least log in to the server with a user with sudo
privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
After successfully SSH, we continue with step 2 to modify the CSF configuration.
Step 2: Modify the CSF configuration
Modifying the CSF configuration is not difficult, we will need to use the following command to open the configuration file.
vi /etc/csf/csf.conf
After opening the configuration file with the above command, we will look for the line SMTP_BLOCK = "1"
and change it to SMTP_BLOCK = "0"
.
Then we need to save this file.
Step 3: Restart CSF
After we have saved the configuration in the previous step, we need to restart CSF to apply this new configuration. We use the following command to restart CSF:
csf -r
So we have completed enabling SMTP on DirectAdmin via SSH. Now you can try your features to see if they are working or not.
III. Summary
Enabling SMTP on DirectAdmin will help you a lot if you have just migrated your website from hosting to a new server that you have just installed but SMTP feature is not working.
There are many reasons why SMTP may not work properly. So if after completing this article, your SMTP is still not working, you should check your SMTP configuration on your website.
Or you can refer to the following tutorial to configure your Gmail account as an SMTP email for your website:
Hope this article will be of help to you. Wishing you success!
See more useful articles about DirectAdmin at the following link:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .