Msmtp-problem - multiple virtual hosts, all using default

Discussion in 'Site & Server Administration' started by PoPSiCLe, Mar 13, 2016.

  1. #1
    I have set up msmtp as a way to send emails - however, I can't seem to get it to pick the right config for sending emails from different vhosts, and I'm getting nowhere with googling.

    I'm using Google servers, btw, if that matters - that works, not problem, it's just that it picks the default account, instead of the specific account

    What I have is this:
    (/etc/.msmtp_php - conf-file)
    
    defaults
    host smtp.gmail.com
    port 587
    auth on
    tls on
    tls_certcheck off
    syslog LOG_MAIL
    
    #account for bergenpchjelp.no
    account bergenpchjelp
    user langbakk@bergenpchjelp.no
    password PASSWORD
    from post@bergenpchjelp.no
    maildomain bergenpchjelp.no
    
    # Set a default account to use
    account default : bergenpchjelp
    
    #account for cntrl.no
    account cntrl
    user langbakk@cntrl.no
    password PASSWORD
    from webmaster@cntrl.no
    maildomain cntrl.no
    
    Code (markup):
    Apart from the password-fields, which I've anonymized, that's exactly how it is.

    Then, I've added the following line to the different vhost-conf-files:
    For the bergenpchjelp-domain:
    php_admin_value sendmail_path "/usr/bin/msmtp -C /etc/.msmtp_php -a bergenpchjelp -t"
    and for the cntrl-domain
    php_admin_value sendmail_path "/usr/bin/msmtp -C /etc/.msmtp_php -a cntrl -t"

    However, it seems it doesn't really read the config file, and use the one specified, it just goes for the default.

    I also have this line in the php.ini:
    sendmail_path = "/usr/bin/msmtp -t -C /etc/.msmtp_php --read-envelope-from --logfile /var/log/msmtp.log"

    Which might bork something, I dunno. Any help would be greatly appreciated
     
    PoPSiCLe, Mar 13, 2016 IP