[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [msmtp-users] 2 domains with msmtp from one PHP?



Am 15.02.2012 22:27, schrieb Martin Lambers:
...
The webscript tells me that the mail function couldn't initialized
- if I switch back to my old config it works.

Any clues?

What gets logged in /var/tmp/msmtp.log? What are the error messages?

unfortunatly nothing, neither in /var/log/msmtp.log nor in
php/error.log or lighttpd/error.log

Successfull usage is debuged like this:
Feb 15 20:37:02 host=smtp.gmail.com tls=on auth=on
user=webmaster@...282... from=webmaster@...283...
recipients=andre.bischof@...282... mailsize=5965 smtpstatus=250
smtpmsg='250 2.0.0 OK 1329334595 w15sm8568001bku.0' exitcode=EX_OK

I assume the problem happens before, thus msmtp is not executed by
phps mail function, therefore the error message by the php script
(mail function couldn't get initialized).

Is there a way to test the msmtp config from the commandline?

Yes, just write a sample mail with From and To headers and try
$ msmtp ... -C msmtprc<  sample-mail.txt

Thanks, testing via commandline with user www-data (the one PHP uses) helped a bit to track the problem down - msmtp always seemed to use the default account from /etc/msmtprc, as there was no default account in msmtprc-www-data-multidomain.

I then moved /etc/msmtprc so it wouldn't be used, msmtpc then complained because there was no default account anymore, I put one in msmtprc-www-data-multidomain and things went well.

But the problem in PHP remained. But trial and error I found out that PHP is disturbed by the --read-envelope-from, maybe because it has double dashes ("--"). I didn't find a short equivalent like -f for --from, I suppose there is none?

Thus:
sendmail_path = "/usr/bin/msmtp -t -i -d --read-envelope-from -C /etc/msmtprc-www-data-multidomain"

works not in php.ini, but:
sendmail_path = "/usr/bin/msmtp -t -i -d -C /etc/msmtprc-www-data-multidomain"

does, but I need the --read-envelope-from option.

Can I put this option in the config file (read-envelope-from on)?

Any other clues how to solve that?

Cheers
Frisco