I have a website with forms where users can send us requests. In addition, the site sends a predefined email to the client. The form receives spam (big surprise) and I'm trying to block emails from going out when some [email protected] emails are used because the destination already told us (at least once) that the email is invalid.
+-----------------+
| Webform |
+------+----------+
|
v
+-----------------+
| PHP |
+------+-------+--+
| |
| +-----------------+
| |
| send form data to us | send thank you note
v v
+----------------------+ +--------------------+
| [email protected] | | [email protected] |
+----------------------+ +--------------------+
I'd like to at least block the email on the right (the one being sent to [email protected]).
For the purpose, I have a bad_recipients file with a list of regular expressions:
/.*hack.*@example.com/ REJECT
...
That works great from my computer, but from local PHP scripts, all the emails go through.
+---------------------------+ +---------------------------+
| | | |
| +---------------------+ | | +---------------------+ |
| | | | SMTP | | | |
| | My Computer Postfix +--|-----------|->| Server Postfix +--|---> destination
| | | | | | | |
| +---------------------+ | | +---------------------+ |
| ^ | | ^ |
| | What here? | | | What here? |
| +----------+----------+ | | +----------+----------+ |
| | | | | | | |
| | My Computer Tool | | | | PHP Website | |
| | | | | | | |
| +---------------------+ | | +---------------------+ |
| | | |
+---------------------------+ +---------------------------+
Note: What here? — I think this is using sendmail and postdrop. Can you confirm?
I'm thinking that the the PHP Website being local to the Server Postfix does not use SMTP. Instead, it would use sendmail and that means it bypasses the SMTP protections:
smtpd_recipient_restrictions=check_recipient_access regexp:/etc/postfix/bad_recipients, ...
Yet, PHP is clearly setup for SMTP:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
Unless that setup is ignored because I'm not under Win32 and thus those parameters would be totally ignored on Linux? (I'm on Ubuntu.)
Is there any way to force Postfix to check the recipient list even when sending emails via sendmail?
Another question in link with the potential sendmail issue. But the answer is to block senders completely (from what I understand) opposed to letting emails through, but still verifying the recipient email address.
Do you have an idea on how to make sure recipients always get blocked?