init-smtpmail.el 943 B

12345678910111213141516171819202122232425
  1. ;; Gandi SMTP
  2. ;; https://docs.gandi.net/en/gandimail/standard_email_settings/index.html
  3. (setq smtpmail-smtp-server "mail.gandi.net"
  4. smtpmail-stream-type 'starttls
  5. smtpmail-smtp-service 587)
  6. ;; REVIEW: If we don't set `user-mail-address', `mail-host-address' or
  7. ;; `message-user-fqdn', `message-make-fqdn' will put
  8. ;; "i-did-not-set--mail-host-address--so-tickle-me" in the In-Reply-To header.
  9. (setq user-mail-address "mail@ambrevar.xyz")
  10. ;; This is only useful to distinguish between similar entries in .authinfo / password-store.
  11. (defun ambrevar/set-smtp-user ()
  12. "Set `smtpmail-smtp-user' to the value in the \"From\" field."
  13. (let ((header-value (message-fetch-field "From")))
  14. (and
  15. header-value
  16. (setq smtpmail-smtp-user
  17. (substring-no-properties
  18. (cadr (mail-extract-address-components header-value)))))))
  19. (add-hook 'message-send-hook #'ambrevar/set-smtp-user)
  20. (provide 'init-smtpmail)