Hi!

On Tue, 14 Feb 2012 14:25:29 +0100, A. Bischof wrote:
> I have msmtp running for some time and like it alot. But now I 
> encountered something which I'm not able to solve by myself - maybe
> you can help me out?
> 
> 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?
> 
> I have php (cgi) configured with an php.ini entry to run msmtp:
> sendmail_path =sendmail_path = "/usr/bin/msmtp -t -i -d -C 
> /etc/msmtprc-www-data" "/usr/bin/msmtp -t -i -d
> -C /etc/msmtprc-www-data"
> 
> In msmtprc-www-data I have an default account:
> 
> # cat /etc/msmtprc-www-data
> account default
> host smtp.gmail.com
> port 587
> timeout 30
> auth on
> user [email protected]
> password ****
> auto_from off
> from [email protected]
> maildomain one.de
> tls on
> tls_starttls on
> tls_trust_file /etc/ssl/certs/ca-certificates.crt
> logfile /var/log/msmtp.log
> 
> Should I use two different accounts with different maildomains? It
> would be great if one could send me the lines I should put in or
> point me to some kind of howto or similar to solve this problem.
> 
> Any help is greatly appreciated.

The 'maildomain' command is only used when 'auto_from' is on, to
construct an envelope from address. But you already set this with the
'from' command.

You should probably define two accounts in your msmtp configuration
file. Since they will be very similar, you can put all common
settings in a 'defaults' section, and put only the differing commands
into account sections:

-----------
defaults
host ...
tls ...
log ...

account one
from [email protected]
user [email protected]
password ***

account two
from [email protected]
user [email protected]
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: [email protected]' and 'From: [email protected]'),
  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

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
msmtp-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/msmtp-users

Reply via email to