1

Topic: Strange behavior when relaying mails

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.7 MARIADB edition.
- Linux/BSD distribution name and version: Linux mail 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux (Debian 9)
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hello,

This is my first installation of iRedMail. I have two domain configured:
- qe.gs -- main domain
- example.com -- one of my client's domain

I created a mailbox monitoring@qe.gs via web iRedAdmin. The purpose of this mailbox is to send monitoring messages from external servers connecting via SMTP. At this point I have three problems:

- Right now the From header looks like this: "From: Cron Daemon <root@qe.gs>" I need to override it so it looks like "From: Anything <monitoring@qe.gs>".

- First "Received: " field looks like this: "Received: from localhost (unknown [80.30.29.216]) by mail.qe.gs (Postfix) with ESMTPSA id AC73340F78 for <xand@xand.es>; Mon, 27 Nov 2017 13:57:03 +0000 (UTC)". I would like to remove this header completely since I don't want to reveal the original IP address, besides I guess it's not necessary at all.

- When a message is sent this way (via SMTP) DKIM signature fails.

On the other hand web interface is working like a charm. Is it possible to correct this points (and how)? Also I attach full message (with headers).

Thanks in advance.

Post's attachments

msg2.txt 4.47 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Strange behavior when relaying mails

xand wrote:

- Right now the From header looks like this: "From: Cron Daemon <root@qe.gs>" I need to override it so it looks like "From: Anything <monitoring@qe.gs>".

If you're talking about email generated by cron job, you should set variable "MAILFROM = xxx" in your cron (edit with command "crontab -e -u <user>").

xand wrote:

- First "Received: " field looks like this: "Received: from localhost (unknown [80.30.29.216]) by mail.qe.gs (Postfix) with ESMTPSA id AC73340F78 for <xand@xand.es>; Mon, 27 Nov 2017 13:57:03 +0000 (UTC)". I would like to remove this header completely since I don't want to reveal the original IP address, besides I guess it's not necessary at all.

This is not necessary. if you do want to remove it, setup a Postfix header_checks rule:
http://www.postfix.org/header_checks.5.html

xand wrote:

- When a message is sent this way (via SMTP) DKIM signature fails.

You mean no DKIM signature? Does the email generated by cron job? or sent by a program wrote in PHP/Python/Shell/... with SMTP AUTH?

3

Re: Strange behavior when relaying mails

Thank you for your answer!

ZhangHuangbin wrote:

If you're talking about email generated by cron job, you should set variable "MAILFROM = xxx" in your cron (edit with command "crontab -e -u <user>").

I guess my version of cron is not accepting this variable. I managed to get this issue fixed. However, somehow cron (located on a completely different machine) managed to deliver messages with From field completely wrong and forbidden (user and domain are changed and this is forbidden by postfix in my configuration).

ZhangHuangbin wrote:

setup a Postfix header_checks rule

Thanks, I will take a look into it.

ZhangHuangbin wrote:

ou mean no DKIM signature? Does the email generated by cron job?

No, I mean the From: header was completely broken in case of cron, that's why the signature was a failure also. However this is already fixed see p1.