help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: > 24.3 can't send mail


From: Tory S. Anderson
Subject: Re: > 24.3 can't send mail
Date: Sat, 07 Feb 2015 09:29:03 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

I should add that the setup I'm using for mail, which has worked for years 
prior to 24.4+, is mostly borrowed from the emacs page 
http://www.emacswiki.org/emacs/SendingMail. To be precise, my source is this: 

--8<---------------cut here---------------start------------->8---
(defvar smtp-accounts
  '(
    (ssl "address@hidden" "smtp.gmail.com"
         587 "address@hidden" secret) ;; Public
;; other accounts omitted
    ))


;; Now lets configure smtpmail.el with your name and functions to send
;; mail using your smtp accounts by changing the from field
(require 'smtpmail)
(setq send-mail-function 'smtpmail-send-it
      message-send-mail-function 'smtpmail-send-it
      mail-from-style nil user-full-name "Tory S. Anderson"
      smtpmail-debug-info t smtpmail-debug-verb t)

(defun set-smtp (mech server port user password)
  "Set related SMTP variables for supplied parameters."
  (setq smtpmail-smtp-server server smtpmail-smtp-service port
        smtpmail-auth-credentials (list (list server port user
                                              password)) 
smtpmail-auth-supported (list mech)
                                              smtpmail-starttls-credentials nil)
  (message "Setting SMTP server to `%s:%s' for user `%s'."
           server port user))

(defun set-smtp-ssl (server port user password &optional key
                            cert)
  "Set related SMTP and SSL variables for supplied parameters."
  (setq starttls-use-gnutls t
        starttls-gnutls-program "gnutls-cli"
        starttls-extra-arguments nil smtpmail-smtp-server server
        smtpmail-smtp-service port
        smtpmail-auth-credentials (list (list server port user
                                              password)) 
smtpmail-starttls-credentials (list (list
                                                                                
              server port key cert)))
  (message
   "Setting SMTP server to `%s:%s' for user `%s'. (SSL
enabled.)" server port user))

(defun change-smtp ()
  "Change the SMTP server according to the current from line."
  (save-excursion
    (loop with from = (save-restriction
                        (message-narrow-to-headers)
                        (message-fetch-field "from"))
          for (auth-mech address . auth-spec) in smtp-accounts
          when (string-match address from) do (cond
                                               ((memq auth-mech '(cram-md5 
plain login))
                                                (return (apply 'set-smtp (cons 
auth-mech auth-spec))))
                                               ((eql auth-mech 'ssl)
                                                (return (apply 'set-smtp-ssl 
auth-spec)))
                                               (t (error "Unrecognized SMTP 
auth. mechanism:
`%s'." auth-mech))) finally (error "Cannot infer SMTP information."))))

;; The previous function will complain if you fill the from field with
;; an account not present in smtp-accounts.

(defvar %smtpmail-via-smtp (symbol-function 'smtpmail-via-smtp))

(defun smtpmail-via-smtp (recipient smtpmail-text-buffer)
  (with-current-buffer smtpmail-text-buffer
    (change-smtp))
  (funcall (symbol-value '%smtpmail-via-smtp) recipient
           smtpmail-text-buffer))

;; Reply-to with same address it was sent to
    (setq gnus-posting-styles
      '(((header "to" "address@hidden")
         (address "address@hidden"))
         ;; more omitted 
))
--8<---------------cut here---------------end--------------->8---

address@hidden (Tory S. Anderson) writes:

> I am unable to send mail in emacs 24.4 or 25.0.5; attempting to send gives me 
> the error:
>
> 530 5.7.0 Must issue a STARTTLS command first. a41sm3439205yhb.43 - gsmtp
>
> According to what I can see by googling around, similar errors have been 
> cropping up for years. I'm just not sure what would have changed between my 
> working
>     GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.9) of 
> 2014-09-30 on buildvm-10.phx2.fedoraproject.org
>
> and those later versions?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]