Hello,

I've recently installed msmtp 1.4.31 and offlineimap to use mu4e in Emacs as an 
interface to my personal email.  Using these applications has worked well for 
me and I have no problems downloading my personal Gmail account using 
offlineimap and sending using msmtp.  I like the searching capabilities of mu4e 
so much that I'd like to do the same for my work email, an Exchange account but 
one that offers IMAP services to end users.  While I have been successsful 
downloading my work email, I have not yet been able to send email with this 
account using msmtp.  I'd appreciate troubleshooting advice from the list.

#msmtp configuration:

My configuration for msmtp, pasted below, is stored in ~/.msmtprc and has 
worked for my personal account (listed in the configuration as "Gmail") and, it 
appears to be at least partially successful in communicating with my work email 
server (account "Work").  The current settings for my Exchange-based work 
account are identical to those I use to successfully send email via smtp on 
Thunderbird on the same machine running Xubuntu 14.04.

---begin quote---

# Accounts will inherit settings from this section
defaults
auth             on
tls              on
tls_starttls     on              
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

# gmail
account        Gmail
host           smtp.gmail.com
port           587
from           usern...@gmail.com
user           usern...@gmail.com
passwordeval    "gpg -q --for-your-eyes-only --no-tty -d ~/.gmailmailpass.gpg"
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# work email
account    Work
host       EMAIL.WORK.COM
auth       ntlm
domain     WORK.COM
ntlmdomain WORKDOMAIN
port       587
from       firstname.lastn...@work.com
user       USERNAME
passwordeval    "gpg -q --for-your-eyes-only --no-tty -d ~/.workmailpass.gpg"
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Set a default account
account default : Work

---end quote---

#testing msmtp:

In order to easily test my msmtp configuration from the command line, I took 
some advice from the ArchWiki (see "testing msmtp" 
https://wiki.archlinux.org/index.php/Msmtp#Test_msmtp), created a simple text 
file per the instructions ("test.email"), and tried out different ports, 
authentication schemes, and username/domain formats.  The example session below 
uses the current settings, the same ones that run successfully under 
Thunderbird on the same machine (although msmtp exposes many more options than 
the Thunderbird interface).

---begin quote---
 
will@willxubook:~$ cat test.email | msmtp -debug -a default usern...@work.com
ignoring system configuration file /etc/msmtprc: No such file or directory
loaded user configuration file /home/will/.msmtprc
using account default from /home/will/.msmtprc
host                  = EMAIL.WORK.COM
port                  = 587
timeout               = off
protocol              = smtp
domain                = WORK.COM
auth                  = NTLM
user                  = USERNAME
password              = *
passwordeval          = gpg -q --for-your-eyes-only --no-tty -d 
~/.workmailpass.gpg
ntlmdomain            = WORKDOMAIN
tls                   = on
tls_starttls          = on
tls_trust_file        = /etc/ssl/certs/ca-certificates.crt
tls_crl_file          = (not set)
tls_fingerprint       = (not set)
tls_key_file          = (not set)
tls_cert_file         = (not set)
tls_certcheck         = on
tls_force_sslv3       = off
tls_min_dh_prime_bits = (not set)
tls_priorities        = (not set)
auto_from             = off
maildomain            = (not set)
from                  = usern...@work.com
dsn_notify            = (not set)
dsn_return            = (not set)
keepbcc               = off
logfile               = /home/will/.msmtp.log
syslog                = (not set)
aliases               = (not set)
reading recipients from the command line
<-- 220 work.com Microsoft ESMTP MAIL Service ready at Thu, 7 Aug 2014 06:57:47 
-0500
--> EHLO WORK.COM
<-- 250-EMAIL.WORK.COM Hello [50.201.41.253]
<-- 250-SIZE 31457280
<-- 250-PIPELINING
<-- 250-DSN
<-- 250-ENHANCEDSTATUSCODES
<-- 250-STARTTLS
<-- 250-AUTH GSSAPI NTLM
<-- 250-8BITMIME
<-- 250-BINARYMIME
<-- 250 CHUNKING
--> STARTTLS
<-- 220 2.0.0 SMTP server ready
TLS certificate information:
    Owner:
        Common Name: WORK.COM
        Organization: SOME UNIVERSITY
        Organizational unit: SOME SCHOOL
    Issuer:
        Common Name: InCommon Server CA
        Organization: Internet2
        Organizational unit: InCommon
        Country: US
    Validity:
        Activation time: Sun 08 Jan 2012 06:00:00 PM CST
        Expiration time: Thu 08 Jan 2015 05:59:59 PM CST
    Fingerprints:
        SHA1: 6A:72:52:C9:29:83:2D:72:DA:92:40:9B:BE:6B:11:58:8A:B5:5B:B9
        MD5:  85:E4:9D:4C:9A:A7:E1:DC:42:D6:B7:C6:F0:68:E3:BE
--> EHLO WORK.COM
<-- 250-WORK.COM Hello [50.201.41.253]
<-- 250-SIZE 31457280
<-- 250-PIPELINING
<-- 250-DSN
<-- 250-ENHANCEDSTATUSCODES
<-- 250-AUTH GSSAPI NTLM
<-- 250-8BITMIME
<-- 250-BINARYMIME
<-- 250 CHUNKING
--> AUTH NTLM
<-- 334 NTLM supported
--> TlRMTVNTUAABAAAAB7IAAAcABwAgAAAACQAJACcAAAB3bW9ucm8xbGF3Y2VudGVy
<-- 334 
TlRMTVNTUAACAAAAEgASADgAAAAFgoECfq4e9WBM+iwAAAAAAAAAAI4AjgBKAAAABgGxHQAAAA9MAEEAVwBDAEUATgBUAEUAUgACABIATABBAFcAQwBFAE4AVABFAFIAAQAKAEUATQBBAEkATAAEABYAbABhAHcALgBsAHMAdQAuAGUAZAB1AAMAIgBlAG0AYQBpAGwALgBsAGEAdwAuAGwAcwB1AC4AZQBkAHUABQAWAGwAYQB3AC4AbABzAHUALgBlAGQAdQAHAAgAhUAlzzayzwEAAAAA
--> 
TlRMTVNTUAADAAAAGAAYAG4AAAAYABgAhgAAABIAEgBAAAAADgAOAFIAAAAOAA4AYAAAAAAAAACeAAAABYKBAkwAQQBXAEMARQBOAFQARQBSAHcAbQBvAG4AcgBvADEAdwBtAG8AbgByAG8AMQClUy0rlHmraG5K7C2HG0DT+mvt0sWQbQUK1rTh5bV3oIy1YhlIwgx9J20XgAHfsEI=
<-- 235 2.7.0 Authentication successful
--> MAIL FROM:<usern...@work.com>
--> RCPT TO:<usern...@work.com>
--> DATA
<-- 250 2.1.0 Sender OK
<-- 250 2.1.5 Recipient OK
<-- 354 Start mail input; end with <CRLF>.<CRLF>
--> To: usern...@gmail.com
--> From: 
--> Subject: A test
--> 
--> Yadda, yadda, yadda.
--> .
<-- 550 5.7.1 Client does not have permissions to send as this sender
msmtp: the server did not accept the mail
msmtp: server message: 550 5.7.1 Client does not have permissions to send as 
this sender
msmtp: could not send mail (account default from /home/will/.msmtprc)
will@willxubook:~$ 

---end quote---

I know very little about email and smtp except what I've been able to learn as 
I've researched this problem.  But when I read the output, I see what appear to 
be two successful authentications eventually ended by an error message from the 
mail server:

<-- 550 5.7.1 Client does not have permissions to send as this sender
msmtp: the server did not accept the mail
msmtp: server message: 550 5.7.1 Client does not have permissions to send as 
this sender
msmtp: could not send mail (account default from /home/will/.msmtprc)

I've looked up the error codes here and found the following:

550 "Requested action not taken: mailbox unavailable"
http://www.greenend.org.uk/rjk/tech/smtpreplies.html

5.7.1 "The sender is not authorized to send to the destination. This can be the 
result of per-host or per-recipient filtering. This memo does not discuss the 
merits of any such filtering, but provides a mechanism to report such. This is 
useful only as a permanent error."
http://www.iana.org/assignments/smtp-enhanced-status-codes/smtp-enhanced-status-codes.xhtml

Knowing very little about smtp error codes, I've asked our email server 
administrator about this.  He suggested that I try prepending the domain to my 
username (e.g., DOMAIN\USERNAME) but that hasn't worked.  I know little about 
this but it appears that the problem is bound up in why, after the successful 
authentications and everything seeming to be correct with starttls, that the 
third authentication fails.  I'd be grateful for guidance on the right 
questions to ask (and how to ask them)!

Thanks for your consideration,

Will

------------------------------------------------------------------------------
_______________________________________________
msmtp-users mailing list
msmtp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msmtp-users

Reply via email to