Open zabous opened 9 months ago
Related to #78
Setting an envelope address (-f $from
) is correct from more points of view.
Return-Path
header and uses it for bounce messages (mailbox full, mailbox does not exist, ...)@zabous Your problem can be on more levels. Default PHP sendmail command is sendmail_path = sendmail -t -i
. Maybe your hosting modified it, should be seen in php info.
The sendmail
command is quite UNIX standard and many non-sendmail MTA emulates it. Maybe it is not full compatible.
Or sending MTA does not allow $from
to be envelope address. Such error could be found in mail log, not sure you can access it.
I see my phpinfo() that "sendmail_path" on my hosting is set to "/usr/bin/msmtp -C /etc/msmtprc -t --read-envelope-from" It works fine without ' -f' param. @milo is there some problem in this setting?
I cannot access mail log - should I try to ask my provider for my mail logs?
From msmtp man page, parameter --read-envelope-from
ensures same behaviour. I cannot test it but probably additional -f
is evaluated as an error.
This is hard to solve in some automatic way. Anyway, I think passing -f
is correct in most cases. Possible solutions in my mind:
SendmailMailer::setEnvelopeFrom(bool)
or introduce __construct()
paramssendmail_path
INI setting, but there are many sendmail clonesOr you can try to use SmtpMailer
, there will be probably available localhost:25
SMTP connection.
Parameter -f
is correct in most cases? I'm afraid that's not enough for general library.
In my opinion, it is better to leave the -f
parameter to the developer using the library.
Thanks for the advice with SendmailMailer::setEnvelopeFrom(bool)
. That can be helpful, but I cannot find this function in SendmailMailer.
Is there another way to turn off adding the -f
parameter?
Parameter
-f
is correct in most cases? I'm afraid that's not enough for general library. In my opinion, it is better to leave the-f
parameter to the developer using the library.
Yes. It is correct to set envelope address to From header.
Thanks for the advice with
SendmailMailer::setEnvelopeFrom(bool)
. That can be helpful, but I cannot find this function in SendmailMailer.
It is only an idea how to solve it by pull request.
Is there another way to turn off adding the
-f
parameter?
No. Send pull request with explanation.
Version: 4.0.2
Bug Description
I have very simple code to send email using SendmailMailer. Everything is working in nette/mail v3.1.11. When I upgrade to nette/mail v4.0.2 there is error:
Steps To Reproduce
Try this code with nette/mail v3.1.11 (working) and with v4.0.2 (not working)
It seems to me, that the problem is on line SendmailMailer.php on line 52 - after removal it work ok.
$cmd .= ' -f' . key($from);
Expected Behavior
Code is working with both versions (v3.1.11 and v4.x.x)