The scheduling report never gone in my mail-box, my FAI orange reject the mail, perhaps the return-path of the mail is not correct.
when i send a report on mail-tester.com, in the source code i see that the return path is like email@example.com
I think that the mail i sent to orange will be dropped systematicaly if the return-path is like orange domain.
Thanks for your response.
thanks for the report. We may have hit the same problem at Piwik PRO. it looks like there is a feature in Zend_Mail v2 http://framework.zend.com/manual/current/en/modules/zend.mail.message.html
setSender that maybe we could use. Not sure if it would fix the issue but it would be worth to try it.
This bug results in several problems, for example scheduled reports not arriving at destination, and also sometimes gmail marking those emails as spam.
email sent from Piwik can have two separate email headers like this:
Return-Path: <php_anonymous<a class='mention' href='https://github.com/lb'>@lb</a>-2.cloud.piwik.pro> [...] Received: from lb-2.cloud.piwik.pro (lb-2.cloud.piwik.pro. [22.214.171.124]) [...] From: "Password recovery (Piwik PRO)" <robot<a class='mention' href='https://github.com/piwik'>@piwik</a>.pro>
php_anonymous<a class='mention' href='https://github.com/lb'>@lb</a>-2.cloud.piwik.prois replaced by
robot<a class='mention' href='https://github.com/piwik'>@piwik</a>.pro.
Return-Path is a separate header from
From I didn't know that, and indeed we only set
I am not sure that
setSender() in ZF2 would do what we expect however there's
setReturnPath() in both ZF1 and 2 (same thing).
The problem is that it might work with Smtp transport (but there's no confirmation on that) but it will not work with Sendmail (the default option). Quoting from the docs (ZF1 and ZF2):
If you set Return-Path on your mail, see Configuring sendmail transport. Unfortunately,
setReturnPath($email)method does not perform this purpose.
It seems the only way to have that header set with sendmail is to either:
customize the CLI command in
php.ini, for example:
sendmail_path = /usr/bin/sendmail -f noreply<a class='mention' href='https://github.com/example'>@example</a>.com
pass the CLI option to the Sendmail transport:
$transport = new Zend_Mail_Transport_Sendmail('-f noreply<a class='mention' href='https://github.com/example'>@example</a>.com');
I don't know if it works if the
-f option is already configured in
This is the solution for the Sendmail transport, I don't know if
setReturnPath() works for Smtp (or if there's another way) as I couldn't find anybody talking about it, and the documentation mentions to use sendmail if we want to set that header so it might not be possible.
On the other hand I had a look at SwiftMailer (most used emailer in PHP) and it seems it abstracts that problem: you add the return-path header by calling
setReturnPath() and the CLI option (
-f ...) will be automatically set. The return-path is also set by default when you
setFrom(). For the Smtp implementation I am not sure, I would need to look deeper into the code to be sure.
@mnapoli interesting that Swiftmailer seems to handle this case automatically... maybe it would be worth using this library instead of ZF. Do you know if the migration from ZF mail to this library would be easy/low effort?
It would require a little effort as Piwik\Mail is
<a class='mention' href='https://github.com/api'>@api</a> and extends
Zend_Mail, which means we basically made
Zend_Mail part of the Piwik API. So we would have to make sure to keep BC on the
Zend_Mail methods if we remove it. I don't expect it to be too complex though, just take a little time to write all those methods.
Decreasing priority as our issue at hand was fixed by admin team by changing postfix server configuration