Topic: php mail() issue
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version: 1.0
- Deployed with iRedMail Easy or the downloadable installer? Installer
- Linux/BSD distribution name and version: Debian 10 Buster
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Problem:
Hosting several pages on apache web server with php-cgi and suexec/FastCGI
So every page runs under its own user.
If i use mail() function with php, it is possible to use any sender address, regardless if the domain is hosted, or if an corresponding mail account exists.
Example mail header:
Return-Path: <user1001@myhostname>
Delivered-To: mailbox@example.de
Received: from myhostname (localhost [127.0.0.1])
by myhostname (Postfix) with ESMTP id 47wNzc0HdHz60CD
for <amailbox@example.de>; Sun, 12 Jan 2020 05:29:48 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at myhostname
Received: from myhostname ([127.0.0.1])
by myhostnamet (myhostname [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id xAmX9qdoVW-t for <mailbox@example.de>;
Sun, 12 Jan 2020 05:29:47 +0100 (CET)
Received: by myhostname (Postfix, from userid 1001)
id 47wNzb5QrTz60CB; Sun, 12 Jan 2020 05:29:47 +0100 (CET)
The Return-Path shows the username from userid1001, which is the first hop:
Received: by myhostname (Postfix, from userid 1001)
How can i do the following:
- check if domain name is allowed for specific userid, if not discard (maybe with a database backend?)
- pipe the mail trough amavis so it gets DKIM signed
- remove or alter the return path
A domain lookup table for allowed sender domains trough local users would be a very nice addition, though
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.