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

[msmtp-users] bug in account selection with default account and inheritance



Hi all,

I'm seeing some very strange behaviour regarding the selection of a
default account with the following config file:

    # Settings common to all mail servers.
    account common
        host dummy
        from aspiers@...247...
        user aspiers
        password CENSORED
        auth on
        tls on
        tls_nocertcheck
        syslog LOG_MAIL

    account emea : common
        host mail.region1.CENSORED.com

    account emea-26 : common
        host mail.region2.CENSORED.com
        port 26

    account ssh-tunnel : common
        host localhost
        port 11125
        # certificate won't match 'localhost'
        tls_nocertcheck

    account default : emea-26

The idea is that the default behaviour should be to send via the
service on port 26 of the region2 server, but that I can easily switch
to using the service on port 25 of the region1 server simply by
providing the arguments '-a emea' to msmtp.

When I run msmtp in 'pretend' mode, it all looks good:

    $ msmtp -d -P --read-envelope-from -C ~/.msmtprc test@...247... < mail.txt
    ignoring system configuration file /etc/msmtprc: No such file or directory
    loaded user configuration file /home/adam/.msmtprc
    using account default from /home/adam/.msmtprc
    host                  = mail.region2.CENSORED.com
    port                  = 26
    timeout               = off
    protocol              = smtp
    domain                = localhost
    auth                  = choose
    user                  = aspiers
    password              = *
    ntlmdomain            = (not set)
    tls                   = on
    tls_starttls          = on
    tls_trust_file        = (not set)
    tls_crl_file          = (not set)
    tls_key_file          = (not set)
    tls_cert_file         = (not set)
    tls_certcheck         = off
    tls_force_sslv3       = off
    tls_min_dh_prime_bits = (not set)
    tls_priorities        = (not set)
    auto_from             = off
    maildomain            = (not set)
    from                  = (read from mail)
    dsn_notify            = (not set)
    dsn_return            = (not set)
    keepbcc               = off
    logfile               = (not set)
    syslog                = LOG_MAIL
    reading recipients from the command line

However, when I remove the '-P' flag, it goes horribly wrong:

    $ msmtp -d --read-envelope-from -C ~/.msmtprc test@...247... < mail.txt
    ignoring system configuration file /etc/msmtprc: No such file or directory
    loaded user configuration file /home/adam/.msmtprc
    using account common from /home/adam/.msmtprc

    host                  = dummy
    port                  = 25
    timeout               = off
    protocol              = smtp
    domain                = localhost
    auth                  = choose
    user                  = aspiers
    password              = *
    ntlmdomain            = (not set)
    tls                   = on
    tls_starttls          = on
    tls_trust_file        = (not set)
    tls_crl_file          = (not set)
    tls_key_file          = (not set)
    tls_cert_file         = (not set)
    tls_certcheck         = off
    tls_force_sslv3       = off
    tls_min_dh_prime_bits = (not set)
    tls_priorities        = (not set)
    auto_from             = off
    maildomain            = (not set)
    from                  = aspiers@...247...
    dsn_notify            = (not set)
    dsn_return            = (not set)
    keepbcc               = off
    logfile               = (not set)
    syslog                = LOG_MAIL
    reading recipients from the command line
    msmtp: cannot locate host dummy: Name or service not known
    msmtp: could not send mail (account common from /home/adam/.msmtprc)

This must be a bug, right?  For some reason it looks like it's
defaulting to the first account in the list, rather than the one
called 'default'.

Thanks,
Adam