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: <firstname.lastname@example.org> [...] Received: from lb-2.cloud.piwik.pro (lb-2.cloud.piwik.pro. [22.214.171.124]) [...] From: "Password recovery (Piwik PRO)" <email@example.com>
firstname.lastname@example.org replaced by
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 email@example.com
- pass the CLI option to the Sendmail transport:
$transport = new Zend_Mail_Transport_Sendmail('-f firstname.lastname@example.org');
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.
TL/DR: - ZF2 is the same as ZF1 - Setting the return path with sendmail needs to be a CLI option, SwiftMailer handles that automatically, we need to set it manually in ZF1 and ZF2. It can also be configured in php.ini. - Setting the return path with SMTP: it seems it should work with all 3 libraries but I can't confirm for 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
@api 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