[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [msmtp-users] 2 domains with msmtp from one PHP?
On Thu, 16 Feb 2012 09:15:23 +0100, A. Bischof wrote:
> 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?
The reason is probably that -d accepts an optional argument, and
therefore --read-envelope-from is misinterpreted as the argument to -d.
You should not use -d in your php.ini anyway; it is strictly for
debugging and may cause problems. While you're at it, you can remove -i
too; it has no effect with msmtp.
There is no short form of --read-envelope-from because msmtp must
remain command line compatible with sendmail. There is no config file
command equivalent because the main purpose of the option is to make
msmtp choose an account based on the From header.
Martin