DirectAdmin only as a mailserver

Laura

Verified User
Joined
Mar 15, 2018
Messages
16
Hello,

I have a DA server where I host domains and mail. Now I want to seperate mail and domains one by one.
I setup a new server with Directadmin and synced everything and want to use this as mail server only.

So currently I have
Old server (which needs to be online till the last domain is migrated)
New server 1 with DirectAdmin for mail only
New server 2 only host domains

The problem is when I migrate one domain with email and point DNS to the servers as above, then the mail does not work correctly.

When sending a mail with mailsoftware it works and test with mail.tester.com score is 10/10.

However, when trying to send from site (WordPress with SMTP plugin installed), it does not work, error:
SMTP Error: Could not connect to SMTP host. STARTTLS command failed STARTTLS command used when not advertised

When disabling "Use this server to handle my e-mails. If not, change the MX records and uncheck this option" sending email works, but I do not receive it, because it is considered as spam and sending an email from mail software generates an error then:

Sending of the message failed.
An error occurred while sending mail. The mail server responded:
Temporary local problem - please try later.

I have no idea how to solve this and make sure WordPress website can send email through SMTP plugin and mail sending with maolsoftware, such as Thunderbird works.

Any suggestiona?
 
Server 1 Only mail
Server 2 Only hosting

On server 2, on any hosting already placed there, uncheck the "use this server to handle my e-mails" and set the MX to server 1.
On server 1, whitelist the ip of server 2 in the /etc/virtual/whitelist_hosts_ip file, otherwise you will get the "helo impersonating domain name" which also will cause this message.
That is the easy solution.

You can also do it another way:
be aware that the exim.conf will be overwritten on update so it might be customised via the custom folder if possible, but I didn't use it.

Do not use server 2 for mail anymore. So if you got Wordpress on there, the smtp credentials for server 1 should be entered, so for mail direct contact is made with server 1.
 
Hi Richard,

Thank you for your help. Unfortunately it is not working. When uncheck the "use this server to handle my e-mails" I cannot send messages from mailsoftware, in my case Thunderbird. Following error:
Sending of the message failed.
An error occurred while sending mail. The mail server responded:
Temporary local problem - please try later.
Please check the message recipient "[email protected]" and try again.

server 2 is not a directadmin server, just a VPS with dockers where WordPress installations can be installed. There I use SMTP plugin where I set the same smtp credentials of the domain, and that works.

It is the opposite when I check the "use this server to handle my e-mails", then SMTP plugin does not work, but send messages from mailsoftware, in my case Thunderbird, works.


The old server is identical to server 1 (the server which I want to use as a mailserver), but with sync everything is identical. With DNS is point mail to server 1 en domain to server 2.
 
Last edited:
It is the opposite when I check the "use this server to handle my e-mails", then SMTP plugin does not work, but send messages from mailsoftware, in my case Thunderbird, works.
Yes that is logical, because the DA server is handling the mail in that case.
So if you use the DA server as mailserver, you must -not- uncheck that. As you say your Thunderbird is getting a 10/10 score, that means that server is installed and configured perfectly.

However you to have to whitelist the VPS ip as I have told, otherwise the mail from Wordpress will be refused.

Did you already whitelisted the VPS ip in the /etc/virtual/whitelist_hosts_ip file and restarted Exim?
 
Hi Richard,

I feel a bit stupid, after whitelisting the VPS IP I forgot to restart Exim. After restart Exim sending mails form both, Thunderbird and from WordPress.

As always, solving one problem generates a new one :) When sending mail to mail address on the same server, it is considered as spam. When I send it to other addresses like gmail or outlook (or with mail-tester.com 10/10) it works perfect. I thought it might related to spamassasin, but I am not sure.

When checking spamassasin I noticed that I cannot enable it. I got the following message (at each user):
Error with template: Cannot write to /home/breedijk/.spamassassin/user_prefs: Error opening /home/breedijk/.spamassassin/user_prefsEL6VY5 as 'breedijk' for writing: Permission denied

I ran the following script to set correct permissions, but no difference.

Code:
#!/bin/bash

for userdir in /home/*; do
    if [ -d "$userdir/.spamassassin" ]; then
        echo "Setting permissions for $userdir/.spamassassin"
        sudo chmod 770 "$userdir/.spamassassin"
    fi
    if [ -f "$userdir/.spamassassin/user_prefs" ]; then
        echo "Setting permissions for $userdir/.spamassassin/user_prefs"
        sudo chmod 755 "$userdir/.spamassassin/user_prefs"
    fi
done

Whatever I try, keeps getting the same error when trying to enable/reach spamassasin on user level. Only admin works, but all the migrated users not. Do you know how to solve this?
 
/home/breedijk/.spamassassin/user_prefsEL6VY5
You have to check this, because this is not normal. Go to this directory via SSH and see how it looks.
It should not read user_prefsEL6VY5 but it should just be user_prefs like this:
-rwxr-xr-x 1 breedijk breedijk 85 2013-05-11 19:20 user_prefs
where ofcourse date/time and kb are different.

If you got those EL6VY5 etc. stuff behind it, them something might have gone wrong on the import.
Also check if the owner is correct.

When sending mail to mail address on the same server, it is considered as spam.
You mean from server 1 to a mail address on server 1? If yes, check your exim logs and post the result here otherwise I'm blind as to which might be the reason.
Normally when the MX setting and A ip address for mail is correct this should not happen.
 
Hi Richard,

There is indeed "stuff" behind. It looks like the home folder messed up, users and domains are in home "everywhere". I have no idea what went wrong during migration, other then my limited knowledge :)

It might be also causing other issues. What is wise, start over the migration? What if I delete the home folder (except the admin) and then resync home folder?
 
What if I delete the home folder (except the admin) and then resync home folder?
Oh did you rsync them? So how are the user accounts created then?

Normally you take admin backups via admin backup/transfer and then restore them also via admin backup/transfer.

If all accounts are already present like they should be, then you could try like you say, but also do not delete the /tmp folder in /home.
 
Back
Top