Mail sending problems from CMS since DA 1.680

Wanabo

Verified User
Joined
Jan 19, 2013
Messages
353
Location
The Netherlands
I have three servers with the same setup. OLS and DA. No custom mods.
Before upgrading DA I always read the whats new info. And because of the Valid sender address change I upgraded only one server, the least important one. Normally I would upgrade every server simultaneously, but luckily I didn't.

My websites are mostly CMS'es. I checked a contact form and get an internal error message by the cms software. Verified my mail setup was valid by using the credentials in roundcube, it is ok. For every website I have created email adresses so that the cms software can make use of the smtp server. (I do not use php mailer.)

Added AUTH_BLOCK_SENDER_SPOOFING = no to /etc/exim.variables.conf.custom
Retested the contact form and got the same error.
Checked /var/log/exim/rejectlog and it showed:
Code:
2025-08-12 20:23:13 H=(www.example.com) [2a00:1:e:3::10] X=TLS1.3:TLS_AES_256_GCM_SHA384:256 CV=no rejected MAIL <[email protected]>: Account [email protected] can not send emails
from [email protected].
This was to be expected after the DA update, but after adding Added AUTH_BLOCK_SENDER_SPOOFING = no to /etc/exim.variables.conf.custom it does still not work! 😒

A contact form is a normal part of a CMS, how can I get it working again? I need the senders email address to reply to him/her!
Luckily registering still works.

1755024630653.png
 
A contact form is a normal part of a CMS, how can I get it working again? I need the senders email address to reply to him/her!
Luckily registering still works.
You should always use a From address that corresponds to the website's domain. The visitor's email address is used in the Reply-To header of the sent email. So you receive it from your website, but will reply to the visitor.
 
@Jos, when I have time I'll mod the contact form.
@Richard, it must be the heatwave making my brains go overheated. Now the contact form reports that my message has been send, but received nothing. In DA mail queue administration I see the not received mails "hanging".
 
but received nothing. In DA mail queue administration I see the not received mails "hanging".
Check the logs, that shows better what's going on about send/receive than the Mail Queue Administration. And yes it's quite hot over here. :)
 
It means that whether phpmail() works or not depends entirely on the PHP handler your server uses:

  1. Your working scenario: Your server is most likely running on php-fpm. In this mode, the PHP script is executed by the actual DA user (e.g., client1). This is a more trusted, traceable source, and for some reason, Exim on your specific setup is allowing it to pass even without SMTP authentication.
  2. My (and others') failing scenario: Our servers are likely running on an older handler (mod_php, or a specific fastcgi setup) where the script is executed by the generic, low-trust apache user. Exim's new block_sender_spoofing rule is precisely designed to block this kind of anonymous, untraceable mail.
PHP's mail() function - by default - will send mail by parsing it directly to the sendmail binary.

If you load up a phpinfo() page from your server and view it in a browser, look for sendmail_path or Path to sendmail This should be set to /usr/sbin/sendmail -t -i If it's not, then that may be your issue.

What this is telling PHP is that calls to mail() passes information directly to this command.

This means that when Exim picks up the message, it is passed through the acl_not_smtp ACL in the exim.conf (which DirectAdmin names acl_script).

Looking at this ACL in the exim.conf file, I don't see where AUTH_BLOCK_SENDER_SPOOFING would have any bearing on the process.

You can see this by viewing the /etc/exim.conf file and searching for acl_script: to see what the entire ACL says.

The first thing it checks is to see if the user has sent too many messages. Now since you are using mod_php then every script - no matter the account - is going to get clumped into this. Every mail() sent through mod_php is going to be sent by the user apache. So if user1 on your server sends 10 messages and user2 on your server sends 100 messages, then apache has now sent 110 messages. But if this is the case, you should be seeing:

User account (apache) has sent too many emails. Script delivery blocked.

in your exim_mainlog.

The next thing the ACL does is check to see if the user (again, this will always be apache for mod_php setups) is listed in the BLACKLIST_USERNAMES file - which would be /etc/virtual/blacklist_usernames. Is apache listed in /etc/virtual/blacklist_usernames? Are any users listed in /etc/virtual/blacklist_usernames?

If this is the case, you should be seeing:

User account (apache) is not allowed to send emails. Script delivery blocked via /etc/virtual/blacklist_usernames

in your exim_mainlog.

Next it checks to see if any user is blacklisted from sending mail through any scripts. These would be listed in the /etc/virtual/blacklist_script_usernames. Is apache or any other user listed in /etc/virtual/blacklist_script_usernames?

If this is the case, you should be seeing:

User account (apache) is not allowed to send emails. Script delivery blocked via /etc/virtual/blacklist_script_usernames

in your exim_mainlog.

Next it checks to see if any of the recipients that the message is being sent to are for any domains that are currently suspended on the server. If it finds one, then the message is denied.

If this is the case, you should be seeing:

The domain ${domain} is currently suspended. Try later.

in your exim_mainlog. (${domain} would be any domain name).

That's really all the ACL checks for.

There are potential include files for this ACL found at:

/etc/exim.acl_script.pre.conf
/etc/exim.blockcracking/script.conf
/etc/exim.blockcracking/script.recipients.conf


Do you have anything in any of these files that might be hindering delivery of PHP mail() messages?

I don't have any servers that use mod_php as the PHP handler, so I can't directly test any of this. But just looking through the flow of how messages are sent with PHP mail() I don't see where AUTH_BLOCK_SENDER_SPOOFING would have any affect on this.

If your PHP is configured to send mail using mail() through an SMTP transaction, then that could definitely explain the issue you are seeing. But - as far as I'm aware - this is not a standard setup for PHP on Linux. On Windows, configuring PHP to use an SMTP transaction would be common (standard?) because Windows has no sendmail (or exim) equivalent.

Additionally sending mail through the sendmail binary has a slight effect on a message deliverability. Because the message is not initially sent as an SMTP transaction as loses a lot of it's characteristics as a legitimate email message. (This is why you'll see a lot of guides or articles advising you to use PHPMailer to send emails from your PHP script, but that bypasses PHP's built-in mail() function). You may have configured your PHP mail() function to pass emails as an SMTP transaction (like a Windows server would do) in order to increase a message's deliverability. Unfortunately, I don't know what this PHP setup would look like since I don't have any servers configured like that.
 
@Jos, when I have time I'll mod the contact form.
@Richard, it must be the heatwave making my brains go overheated. Now the contact form reports that my message has been send, but received nothing. In DA mail queue administration I see the not received mails "hanging".
Checking the logs will likely reveal more information than any GUI tool.

Some of this may be in what email addresses you are using, and it's hard to tell with your obfuscation (not complaining about obfuscation, just stating that it's difficult to tell).

Are you by chance sending out emails using a FROM address of [email protected]? The example.com domain is common as a default setting in a lot of CMS software. Presumably, you don't own the example.com domain name, so SPF and DKIM is going to fail at the recipient end when they receive a message from your server from the example.com domain name.
 
  • Like
Reactions: fln
Are you by chance sending out emails using a FROM address of [email protected]? The example.com domain is common as a default setting in a lot of CMS software. Presumably, you don't own the example.com domain name, so SPF and DKIM is going to fail at the recipient end when they receive a message from your server from the example.com domain name.
No I used example.com for obfuscation. The problem is that a user enters his legitimate personal email address in the contact form. But the contact forms sends the mail to me as if it was send by the user. This was never a problem until now (worked for 23+ years). I have to check every contact-, feedback-, etc. form to include the users mail in the message and use the domain email as the sender. That is a lot of work and a great challenge for my pour PHP coding skills, so for now I go for the work around AUTH_BLOCK_SENDER_SPOOFING = no

But still not convinced this work around works. The mails are still in the mail queue.
 
Thanks for a very thorough debug guide @sparek. One thing to keep in mind. If jail (bubblewrap) system is enabled for the user the CLI call to sendmail would not work, because exim can not be accessed from within the jailed environment. In such environments the sendmail binary is replaced with a script that receives the email via CLI and then uses msmtp tool to actually connect to the mail server on localhost and deliver the message over SMTP.

This means that even using simple PHP mail() function, if user is running in jailed environment the email will be delivered over SMTP. However the AUTH_BLOCK_SENDER_SPOOFING will not block impersonation attempts as long as user is impersonating one of the domains he owns. Jailed environment uses UNIX user account for authentication over SMTP and unix users are allowed to send from any address in DA 1.680. In DA 1.681 SMTP sessions with UNIX user account can send from any email address (local part) under user owned domains (domain part).
 
:cry:A new message or response with subject: DirectAdmin has been updated to v1.680😢
Another server with auto-update it seems. Bye bye movie, hello DA server problem fixing.
 
This means that even using simple PHP mail() function, if user is running in jailed environment the email will be delivered over SMTP. However the AUTH_BLOCK_SENDER_SPOOFING will not block impersonation attempts as long as user is impersonating one of the domains he owns. Jailed environment uses UNIX user account for authentication over SMTP and unix users are allowed to send from any address in DA 1.680. In DA 1.681 SMTP sessions with UNIX user account can send from any email address (local part) under user owned domains (domain part).
Is PHP-FPM suppose to operate in a jailed environment?

Or are you referring to running PHP from a shell, when that shell is /usr/bin/jailshell?
 
PHP-FPM is not jailed, however it should affect fastcgi mode. Also emails from cron or other tools from CLI that end up executing sendmail.
 
Last edited:
When the second server updated I tested a contact form that worked perfectly (with: AUTH_BLOCK_SENDER_SPOOFING = no)
Why wouldn't it work on the first server with the same contact form? I tried several things, including scrutinizing the logs.

Modded the contact page to use smtp_username instead of the email adres entered in the contact form as the sender from address. Transferred the relevant info, (sender email, name, subject) into the message body. This worked on the second server, but not on the first server.

Well as said, the first server is the least important one, and I choose a website hosted on that server that I often use for testing.
I used this domain in the past with the mail service from MXroute, to make that work I had to disable Local Mail (Use this server to handle my e-mails. If not, change the MX records and uncheck this option). My dns and mx entries although were ok to handle local mail.

After enabling the local mail option, the contact form works again. :)
 
After enabling the local mail option, the contact form works again. :)
I have used MXroute RBL's before (which he uses himself too), they are great, unfortunately a bit too great, because various valid mails did not came through anymore because it uses too many netblocks. Could very well be that was the case.
 
In this case mxroute is not to blame, but only me. I forgot I had the local mail option disabled for the domain in question.
I have a positive experience with mxroute, it saved me the previous summer when I had email problems on my servers. At the moment I have this service dormant, but I'll gladly pay a yearly fee for this as a backup.
 
I have used MXroute RBL's before (which he uses himself too), they are great, unfortunately a bit too great, because various valid mails did not came through anymore because it uses too many netblocks. Could very well be that was the case.
Too many false positives for my liking. I run my own RBL with rbldnsd because I had a very prolific spammer a few years ago, but rbl in general is kind of annoying.

I like his new strategy, which I'm inclined to borrow/steal. Just outright block bad ASNs.
 
Back
Top