Created
March 5, 2014 18:42
-
-
Save antifuchs/9373768 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; SMTP settings: | |
;; Available SMTP accounts. | |
(require 'smtpmail) | |
(setq smtpmail-smtp-server "smtp.gmail.com" | |
smtpmail-smtp-service 587 | |
starttls-use-gnutls t | |
send-mail-function 'smtpmail-send-it | |
message-send-mail-function 'smtpmail-send-it | |
mail-from-style 'angles | |
smtpmail-debug-info t | |
smtpmail-debug-verb t) | |
(defun asf-change-smtp () | |
"Change gmail SMTP auth to what's in the from field." | |
(save-excursion | |
(save-restriction | |
(message-narrow-to-headers) | |
(let* ((from (message-fetch-field "from")) | |
(address (cadr (mail-extract-address-components from)))) | |
(setq smtpmail-smtp-user address))))) | |
(add-hook 'message-send-hook 'asf-change-smtp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment