0

I use Emacs and mu4e to send mail. I have a mail server with Amazon WorkMail and I set up the information at ~/.authinfo.gpg. Two domains are in the same region and have the same SMTP server with different usernames. When I send email from the second, it is sent with the credentials from the first which appears at the top of the list.

My code is:

(defvar my-mu4e-account-alist
  '(
    ("Account1"
     (mu4e-sent-folder "/Account1/Sent Items")
     (mu4e-drafts-folder "/Account1/Drafts")
     (mu4e-trash-folder "/Account1/Deleted Items")
     (user-mail-address "name@account1.org")
     (smtpmail-smtp-user "name@account1.org")
     (smtpmail-stream-type ssl)
     (smtpmail-smtp-service 465)
     )
    ("Account2"
     (mu4e-sent-folder "/Account2/Sent Items")
     (mu4e-drafts-folder "/Account2/Drafts")
     (mu4e-trash-folder "/Account2/Deleted Items")
     (user-mail-address "name@account2.org")
     (smtpmail-smtp-server "smtp.mail.eu-west-1.awsapps.com")
     (smtpmail-stream-type ssl)
     (smtpmail-smtp-service 465)
     )
    ))

How can I force each account to use its own account on the server?

0

I read the manual again:

If the variable smtpmail-smtp-user is set to a non-nil value, then only entries for that user are considered. For more information on the ~/.authinfo file, see auth-source.

So I used this and it worked:

(defvar my-mu4e-account-alist
  '(
    ("Account1"
     (mu4e-sent-folder "/Account1/Sent Items")
     (mu4e-drafts-folder "/Account1/Drafts")
     (mu4e-trash-folder "/Account1/Deleted Items")
     (user-mail-address "name@account1.org")
     (smtpmail-smtp-user "name@account1.org")
     (smtpmail-smtp-server "smtp.mail.eu-west-1.awsapps.com")
     (smtpmail-stream-type ssl)
     (smtpmail-smtp-service 465)
     )
    ("Account2"
     (mu4e-sent-folder "/Account2/Sent Items")
     (mu4e-drafts-folder "/Account2/Drafts")
     (mu4e-trash-folder "/Account2/Deleted Items")
     (user-mail-address "name@account2.org")
     (smtpmail-smtp-user "name@account2.org")
     (smtpmail-smtp-server "smtp.mail.eu-west-1.awsapps.com")
     (smtpmail-stream-type ssl)
     (smtpmail-smtp-service 465)
     )
    ))
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.