Repository navigation
Unable to send email using SendmailMailer in v4.0.2 #96
Description
Activity
Related to #78
Setting an envelope address (
-f $from) is correct from more points of view.- receiving MTA puts this address into message as a
Return-Pathheader and uses it for bounce messages (mailbox full, mailbox does not exist, ...) - receiving MTA uses envelope address for SPF policy evaluation (not sure it's standard, at least GMail does it) which is todays quite important
@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
sendmailcommand is quite UNIX standard and many non-sendmail MTA emulates it. Maybe it is not full compatible.Or sending MTA does not allow
$fromto be envelope address. Such error could be found in mail log, not sure you can access it.- receiving MTA puts this address into message as a
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-fromensures same behaviour. I cannot test it but probably additional-fis evaluated as an error.This is hard to solve in some automatic way. Anyway, I think passing
-fis correct in most cases. Possible solutions in my mind:- add
SendmailMailer::setEnvelopeFrom(bool)or introduce__construct()params - somehow detect it from
sendmail_pathINI setting, but there are many sendmail clones
Or you can try to use
SmtpMailer, there will be probably availablelocalhost:25SMTP connection.Reacted by zabous- add
Parameter
-fis correct in most cases? I'm afraid that's not enough for general library.
In my opinion, it is better to leave the-fparameter 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
-fparameter?Parameter
-fis correct in most cases? I'm afraid that's not enough for general library. In my opinion, it is better to leave the-fparameter 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
-fparameter?No. Send pull request with explanation.
added
SendmailMailer::setEnvelopeSender()
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)