reddit / emacs

Mu4e suddenly stopped working! `smtpmail-send-it: Sending failed: 554 5.7. Sender address rejected: Access denied`

abougouffa · 2022-05-11 23:33
Hello Emacsers! ## UPDATE (SOLVED) For those who might face the same problem. I managed to solve it, in fact it was the Emacs `smtpmail` library (maybe in combination with a recent change on the server side). I added the SMTP server I'm using to the variable `smtpmail-servers-requiring-authorization`, which is documented as follows: > "Regexp matching servers that require authorization. **Normally smtpmail will try first to send emails via SMTP without user/password credentials**, and then retry using credentials if the server says that it requires it. If the server name matches this regexp, smtpmail will send over the credentials on the first attempt." Recently, we received a phishing mail in a work mailing list, the mail was sent from what it seems to be a valid address in the university's domain name. I guess the sysadmin disabled sending mails without credentials after that. ## Original question I'm facing a strange problem with mu4e, I had a pretty stable multi-context setup (using the `mu4e` module of Doom Emacs). My complete mu4e configuration can be found [in my dotfiles repo](https://github.com/abougouffa/dotfiles/blob/main/dot_doom.d/config.org#email-mu4e). For the problematic account, it has config similar to this one: ```lisp (set-email-account! "My Account" '((mu4e-sent-folder . "/dir/Sent") (mu4e-drafts-folder . "/dir/Drafts") (mu4e-trash-folder . "/dir/Trash") (mu4e-refile-folder . "/dir/Archive") (smtpmail-smtp-user . "mail@address.com") (user-mail-address . "mail@address.com") (smtpmail-stream-type . ssl) (smtpmail-smtp-server . "smtp.address.com") (smtpmail-smtp-service . 465)) t) ``` Suddenly, I cannot send email with one of my accounts, I get this error each time I try to send an email: ``` smtpmail-send-it: Sending failed: 554 5.7.1 <my_email_address@server.com>: Sender address rejected: Access denied ``` I don't think it is a server side problem because I can send emails from my phone with the exact same server and protocol settings. I tried to change settings to use **starttls** instead. ```lisp (set-email-account! "My Account" '((mu4e-sent-folder . "/dir/Sent") (mu4e-drafts-folder . "/dir/Drafts") (mu4e-trash-folder . "/dir/Trash") (mu4e-refile-folder . "/dir/Archive") (smtpmail-smtp-user . "mail@address.com") (user-mail-address . "mail@address.com") (smtpmail-stream-type . starttls) (smtpmail-smtp-server . "smtp.address.com") (smtpmail-smtp-service . 587)) t) ``` With these settings, I get this error: ``` smtpmail-send-it: Sending failed: 454 4.7.1 <destination@address.com>: Relay access denied ``` I wiped my `~/.authinfo.gpg`, I always get the same errors. *mu4e* doesn't ask me about the password anymore, while for the other accounts, when I send a mail for the first time, it asks me about the password and adds it to `~/.authinfo.gpg`. Does anyone have an idea? By the way, I'm using Emacs 28.1 (nativecomp).
worthless-trash · 2022-05-11 23:49
Does the mx from your phone and system resolve to the same IP?
nv-elisp · 2022-05-11 23:50
You don't mention the mail service. Gmail has been recently deprecating support for "less secure apps".
abougouffa · 2022-05-12 00:13
It is my work account. It is hosted on the university, so do not depend on Google services.
abougouffa · 2022-05-12 00:14
I didn't check, however, both the PC and the phone are on the same network, they should resolve to the same IP AFAIK.
worthless-trash · 2022-05-12 00:30
Could have cached DNS data on one.
abougouffa · 2022-05-12 00:47
Yes, it could! I did clear the cache in my PC, and I did restart my phone. The problem persistent! I noticed another strange thing, when I send a mail from mu4e to my own address (the problematic account address), it did pass and I receive it on my phone too!