reddit / emacs

Diagnosing issue with mu4e/SMTP send

digitaleft · 2022-08-31 21:47
**Final Update** (barring new insight), I have switched to using msmtp for outgoing mail and it works perfectly. Links below. --- Hey, I recently set up mu4e following [SystemCrafter's guide](https://github.com/daviwil/emacs-from-scratch/blob/master/show-notes/Emacs-Mail-03.org) and was pleased to find everything worked upon setup. However, about a week later I found Emacs now hangs entirely whenever I try to send a message. I don't recall making any changes to my config since then, though have had system updates (Fedora) Running a backtrace of the freeze using `SIGUSR 2`, I get this: * substitute-command-keys("Quit") make-network-process(:name "smtpmail" :buffer #<buffer *trace of SMTP session to smtp.office365.com*> :host "smtp.office365.com" :service 25 :coding nil) network-stream-open-starttls("smtpmail" #<buffer *trace of SMTP session to smtp.office365.com*> "smtp.office365.com" 25 (:type starttls :return-list t :warn-unless-encrypted nil :capability-command "EHLO fedora\15\n" :end-of-command "^[0-9]+ .*\15\n" :success "^2.*\n" :always-query-capabilities t :starttls-function #<subr F616e6f6e796d6f75731d6c616d626461_anonymous_lambda_43> :client-certificate t :use-starttls-if-possible t)) open-network-stream("smtpmail" #<buffer *trace of SMTP session to smtp.office365.com*> "smtp.office365.com" 25 :type starttls :return-list t :warn-unless-encrypted nil :capability-command "EHLO fedora\15\n" :end-of-command "^[0-9]+ .*\15\n" :success "^2.*\n" :always-query-capabilities t :starttls-function #<subr F616e6f6e796d6f75731d6c616d626461_anonymous_lambda_43> :client-certificate t :use-starttls-if-possible t) smtpmail-via-smtp(("recipient@email.com") #<buffer smtpmail temp>) smtpmail-send-it() message-multi-smtp-send-mail() message--send-mail-maybe-partially() message-send-mail(nil) message-send-via-mail(nil) message-send(nil) message-send-and-exit(nil) funcall-interactively(message-send-and-exit nil) command-execute(message-send-and-exit) Though I'm not sure how to interperate it. The command also creates a SMTP trace buffer which is blank. FWIW my .authinfo.gpg looks like this: machine smtp.office365.com login email@mail.com password "mypassword" port 587 And my mu4e config contains: :config (setq message-send-mail-function 'smtpmail-send-it) (setq mu4e-contexts (list ;; Work account (make-mu4e-context :name "Work" :match-func (lambda (msg) (when msg (string-prefix-p "/work" (mu4e-message-field msg :maildir)))) :vars '((user-mail-address . "email@mail.org") (user-full-name . "My Name") (mu4e-compose-signature . "my signature") (smtpmail-smtp-server . "smtp.office365.com") (nsmtpmail-smtp-service . 587) (smtpmail-stream-type . starttls) (smtpmail-debug-info . t) (setq mu4e-drafts-folder "/Drafts") (setq mu4e-refile-folder "/Archive") (setq mu4e-sent-folder "/Sent Items") (setq mu4e-trash-folder "/Deleted Items"))))) Any ideas? Thanks **Update:** So I found that the SMTP settings are indeed correct, and I can send messages through Thunderbird. I found [this older email thread](https://mail.gnu.org/archive/html/hep-gnu-emacs/2010-04/msg00114.html) where a few others had a similar issue. Using ~gnutls-cli~ which seems to also have issues bytes sending to the server? Pretty perplexed. In all of this I did discover [msmtp](https://marlam.de/msmtp/) and it looks like the [configuration with mu4e](https://tushartyagi.com/blog/configure-mu4e-and-msmtp/) is a little more ellegant. For future users in a similar bind: if I don't update again this is likely the reason
rpluim · 2022-09-01 10:14
You have a typo: that should be `smtpmail-smtp-service`. The original trace shows emacs trying to connect to port 25, not 587, which is disallowed by a lot of ISPs.
digitaleft · 2022-09-06 23:52
ha such a simple mistake! Thanks so much for the response, I've confirmed this was the issue.