[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 19:18, schrieb Martin Lambers:
On Wed, 15 Feb 2012 19:02:32 +0100, A. Bischof wrote:
I have a server running php (with lighttpd, not apache) for
different domains. I have google mail accounts for the domains.
Now I must send mails from domain one.de with another sender then
domain two.de

How can this be achieved?
...
-----------
defaults
host ...
tls ...
log ...

account one
from webmaster@...280...
user webmaster@...280...
password ***

account two
from webmaster@...281...
user webmaster@...281...
password ***
------------

Now you have multiple options:
- if you can use different php.ini files for your domains, you can
    choose an account with the --account option.
- if your php scripts set a 'From' header in each mail depending on
the domain (e.g. 'From: webmaster@...280...' and 'From:
webmaster@...281...'), you can use the --read-envelope-from option of
msmtp. Then msmtp reads this From address and automatically chooses
the account that has a matching 'from' command.

Martin,

I can't get it working, would you mind having a look what's wrong?

I call from cgi/php.ini with --read-envelope-from:
sendmail_path = "/usr/bin/msmtp -t -i -d --read-envelope-from -C /etc/msmtprc-www-data-multidomain"

(or should I put "read-envelope-from on" in the config file under defaults?

My config files belongs to www-data and now looks like you suggested:
# cat msmtprc-www-data-multidomain
defaults
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /var/log/msmtp.log
auto_from off
host smtp.gmail.com
port 587
timeout 30
auth on

account rheinsinn
#auto_from off
#read-envelope-from on
from webmaster@...282...
#maildomain rheinsinn.de
user webmaster@...282...
password ****


account coaching-evaluationen
#auto_from off
#read-envelope-from on
from webmaster@...283...
#maildomain coaching-evaluationen.de
user webmaster@...283...
password ****

The webscript tells me that the mail function couldn't initialized - if I switch back to my old config it works.

Any clues?

Cheers
Frisco