Closed geerlingguy closed 9 years ago
Thanks @geerlingguy, I'll have a look
I can confirm this problem.
The simple workaround is to provide a dummy email address in PHPs sendmail_path
:
sendmail_path = "/usr/local/sbin/mhsendmail test@test.com"
The recipient will be overwritten when the "To:" header is added by PHPs mail()
function.
Thanks, and sorry, haven't had time to look at it yet, I'll get a fix in asap!
:+1:
Thanks!
Looks like this works, but could you tag a new release so we can download the binary for use in other projects? :)
+1 on the new binaries, I pull them using Chef for our development environment and just got bit by this!
The re for find To: doesn't work correctly Here is a fix.
re := regexp.MustCompile("(?im)^To: (.*)\r*$")
I kept digging deeper and deeper (I really want to use mhsendmail instead of sSMTP for my Drupal dev environments!), and found that PHP's mail() function is the culprit here, in terms of how it uses sendmail...
To reproduce, install PHP on a server, set the
sendmail_path
ini directive to the path to themhsendmail
binary, then create a script somewhere with the following test:If you run the script by accessing it through a webserver, check the webserver's error logs; you should get a message
missing recipient
, frommhsendmail
.The problem is that it seems
mhsendmail
is expecting the recipient as one of the command line args, but PHP'smail()
function passes the recipient as a line in the header ('To: [recipient]'). See php-src: https://github.com/php/php-src/blob/fc33f52d8c25997dd0711de3e07d0dc260a18c11/ext/standard/mail.c#L356-L361I think if you can make it so
mhsendmail
accepts the To address as the first line of stdin, it might work...