4

I'm just getting started with mu4e after using Gnus for about a year. The sending of mail seems similar between the two, but mu4e hangs when I try to send mail and finally fails with the error:

network-stream-open-starttls: Failed connect: connection timed out.

Here's my .emacs.d:

;; * mu4e
(require 'mu4e)
(setq mail-user-agent 'mu4e-user-agent)

(setq mu4e-maildir "/home/steven/mail/")

(setq mu4e-sent-folder   "/sent")
(setq mu4e-drafts-folder "/drafts")
(setq mu4e-trash-folder  "/trash")

(setq   mu4e-maildir-shortcuts
'(("/archive"     . ?a)
  ("/inbox"       . ?i)
  ("/sent"        . ?s)))

;; smtp mail settings
(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "example.server.com")

Is there anything here that would foul sending a message? If not, where might I look next for the cause of this behavior, or what experiment might I run to deduce the problem?

4
  • 1
    Try setting smtpmail-debug-info to t. That should cause a buffer called *trace of SMTP session to example.server.com* to be created, which should contain more information. If Emacs keeps being stuck, interrupting it with C-g should help.
    – legoscia
    Aug 12, 2015 at 12:36
  • I gave this a try, and although the *trace of SMTP* buffer ended up emtpy, I did find something by looking in *Messages*. I've added it to my post above, too: network-stream-open-starttls: Failed connect: connection timed out Aug 12, 2015 at 17:49
  • 1
    That's weird: that's a network error, so you should get exactly the same result with Gnus and mu4e... Another thing you can look at is smtpmail-smtp-service, for the port number of the SMTP server. It defaults to 25, but many mail servers want it to be 587 these days.
    – legoscia
    Aug 12, 2015 at 18:07
  • That worked perfectly! Wow, I would never have figured that out on my own. Thank you so much! -steven Aug 12, 2015 at 18:39

1 Answer 1

3

Apart from the variables listed in your question, have a look at smtpmail-smtp-service, which specifies the port number that the SMTP server is reachable at. The default value of this variable is 25, but nowadays many SMTP servers use port 587 instead.


The SMTP protocol is used for two different use cases:

  • mail servers relaying a message in the direction of its ultimate destination (usually to the mail server of the recipient, but sometimes passing through a chain of intermediate servers), and
  • mail clients submitting a message to their local mail server for delivery.

Those two use cases often have different requirements (for mail servers, check that they are allowed to relay messages for the sender address; for mail clients, require encryption and authentication), and so requiring mail clients to use port 587 instead of port 25 could help in making that distinction. This is described in much more detail in RFC 6409.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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