all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Dynamically switching send-mail settings
  2015-02-08 21:49 Dynamically switching send-mail settings (WAS: > 24.3 can't send mail) Robert Thorpe
@ 2015-02-09  2:54 ` Tory S. Anderson
       [not found] ` <mailman.19558.1423450457.1147.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 7+ messages in thread
From: Tory S. Anderson @ 2015-02-09  2:54 UTC (permalink / raw)
  To: Robert Thorpe; +Cc: help-gnu-emacs

In this case it happens even if not a gmail account, and unfortunately a new day didn't fix it. Two questions: First, with this message:

    Opening TLS connection with `gnutls-cli --insecure -p 587 smtp.gmail2.com'...failed
    Opening TLS connection with `gnutls-cli --insecure -p 587 smtp.gmail2.com --protocols ssl3'...failed
    Opening TLS connection with `openssl s_client -connect smtp.gmail2.com:587 -no_ssl2 -ign_eof'...done

Is it expected to cycle through different TLS methods? 
Second, could my change be occurring too late? Right now I have my function on a hook as follows:
--8<---------------cut here---------------start------------->8---
(add-hook 'message-send-hook 'change-smtp)
;(add-hook 'message-send-mail-hook 'change-smtp)
--8<---------------cut here---------------end--------------->8---

I've tried both hooks (one is supposed to be earlier in the send process) and the results don't change. The original version that worked <24.4 didn't use a hook it all; as far as I can tell it did some magic I don't understand with this:

--8<---------------cut here---------------start------------->8---
(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))
--8<---------------cut here---------------end--------------->8---

Is changing the server/port settings in one of the send-hooks too late? And what is that original magic with the symbols and symbol-function?




Robert Thorpe <rt@robertthorpeconsulting.com> writes:

> torys.anderson@gmail.com (Tory S. Anderson) writes:
>
>> And, at that, it freezes with the final line in my message buffer until I C-g to safety. Any ideas why it freezes at this point, having done the dynamic setting correctly? Note that I've successfully sent with this account today before I started working on the dynamic switching, so I know the settings are otherwise correct. Below are the functions I'm using: 
>
> One of the peculiarities of gmail is that if you're using it over IMAP,
> POP and SMTP.  It limits the number of transactions you can do with it
> per day.  People who are having problems with their config often hit
> this limit while experimenting.
>
> However, AFAIK it only applies to receive operations (i.e. IMAP & POP),
> not to SMTP.  Maybe I'm wrong about that though.  Regardless your setup
> may magically start working tomorrow.
>
> BR,
> Robert Thorpe



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dynamically switching send-mail settings
       [not found] ` <mailman.19558.1423450457.1147.help-gnu-emacs@gnu.org>
@ 2015-02-09  5:03   ` Lars Magne Ingebrigtsen
  2015-02-09 12:18     ` Tory S. Anderson
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2015-02-09  5:03 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: help-gnu-emacs, Robert Thorpe

torys.anderson@gmail.com (Tory S. Anderson) writes:

> In this case it happens even if not a gmail account, and unfortunately
> a new day didn't fix it. Two questions: First, with this message:
>
>     Opening TLS connection with `gnutls-cli --insecure -p 587
> smtp.gmail2.com'...failed

If you get these messages, then that means that your Emacs hasn't been
built with libgnutls support.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dynamically switching send-mail settings
  2015-02-09  5:03   ` Lars Magne Ingebrigtsen
@ 2015-02-09 12:18     ` Tory S. Anderson
  2015-02-18  1:20       ` Lars Ingebrigtsen
  2015-04-15 16:08       ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 7+ messages in thread
From: Tory S. Anderson @ 2015-02-09 12:18 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: help-gnu-emacs, Robert Thorpe

Thanks Lars, 

After years of emailing in Gnus I didn't think that was an issue; I guess I thought gnutls was built in to Fedora, or I wouldn't have been working. Anyway, I sudo yum installed it and rebuilt emacs. Now I get a different set of errors:

    gnutls.c: [1] (Emacs) allocating credentials
    gnutls.c: [1] (Emacs) setting the trustfile:  /etc/pki/tls/certs/ca-bundle.crt
    gnutls.c: [1] (Emacs) gnutls callbacks
    gnutls.c: [1] (Emacs) gnutls_init
    gnutls.c: [1] (Emacs) got non-default priority string: NORMAL
    gnutls.c: [1] (Emacs) setting the priority string
    gnutls.c: [audit] Note that the security level of the Diffie-Hellman key exchange has been lowered to 256 bits and this may allow decryption of the session data

    gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily unavailable, try again. [11798 times]
    gnutls.c: [audit] Received record packet of unknown type 50

    gnutls.c: [0] (Emacs) fatal error: An unexpected TLS packet was received.
    gnutls.el: (err=[-15] An unexpected TLS packet was received.) boot: (:priority NORMAL :hostname mail.toryanderson2.com :loglevel 1 :min-prime-bits 256 :trustfiles (/etc/pki/tls/certs/ca-bundle.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
    gnutls-negotiate: GnuTLS error: #<process smtpmail>, -15

I was happy to see the Diffie-Hellman alert; that's what I get on my working email setup. But what's with the gnutls errors now? Seems like I'm getting closer and closer...



Lars Magne Ingebrigtsen <lmi@gnus.org> writes:

> torys.anderson@gmail.com (Tory S. Anderson) writes:
>
>> In this case it happens even if not a gmail account, and unfortunately
>> a new day didn't fix it. Two questions: First, with this message:
>>
>>     Opening TLS connection with `gnutls-cli --insecure -p 587
>> smtp.gmail2.com'...failed
>
> If you get these messages, then that means that your Emacs hasn't been
> built with libgnutls support.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dynamically switching send-mail settings
  2015-02-09 12:18     ` Tory S. Anderson
@ 2015-02-18  1:20       ` Lars Ingebrigtsen
  2015-02-18  2:10         ` Tory S. Anderson
  2015-04-15 16:08       ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2015-02-18  1:20 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: help-gnu-emacs, Robert Thorpe

torys.anderson@gmail.com (Tory S. Anderson) writes:

>     gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily
> unavailable, try again. [11798 times]
>     gnutls.c: [audit] Received record packet of unknown type 50
>
>     gnutls.c: [0] (Emacs) fatal error: An unexpected TLS packet was received.
>     gnutls.el: (err=[-15] An unexpected TLS packet was received.)
> boot: (:priority NORMAL :hostname mail.toryanderson2.com :loglevel 1
> :min-prime-bits 256 :trustfiles (/etc/pki/tls/certs/ca-bundle.crt)
> :crlfiles nil :keylist nil :verify-flags nil :verify-error nil
> :callbacks nil)

I think this probably means that the SMTP server is closing the
connection for some reason or other.  Try setting `smtpmail-debug-info'
and look in the trace buffer to see whether it has anything interesting
to say.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dynamically switching send-mail settings
  2015-02-18  1:20       ` Lars Ingebrigtsen
@ 2015-02-18  2:10         ` Tory S. Anderson
  0 siblings, 0 replies; 7+ messages in thread
From: Tory S. Anderson @ 2015-02-18  2:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: help-gnu-emacs, Robert Thorpe

Thanks. I was able to fix this as part of a veritable ordeal. I'm not sure which things fixed this particular problem (I was trouble shooting various things at once), but steps included:
- Building emacs with gnutls support (which I hadn't originally realized wasn't being done)
- Ensuring that there were no blank lines separating authinfo entries
- Validating that my email-switching functions were on the correct sendmail hooks
- Ensuring that I was using consistent smtp-server port numbers between the .gnus config and the .authinfo entries

Lars Ingebrigtsen <larsi@gnus.org> writes:

> torys.anderson@gmail.com (Tory S. Anderson) writes:
>
>>     gnutls.c: [1] (Emacs) non-fatal error: Resource temporarily
>> unavailable, try again. [11798 times]
>>     gnutls.c: [audit] Received record packet of unknown type 50
>>
>>     gnutls.c: [0] (Emacs) fatal error: An unexpected TLS packet was received.
>>     gnutls.el: (err=[-15] An unexpected TLS packet was received.)
>> boot: (:priority NORMAL :hostname mail.toryanderson2.com :loglevel 1
>> :min-prime-bits 256 :trustfiles (/etc/pki/tls/certs/ca-bundle.crt)
>> :crlfiles nil :keylist nil :verify-flags nil :verify-error nil
>> :callbacks nil)
>
> I think this probably means that the SMTP server is closing the
> connection for some reason or other.  Try setting `smtpmail-debug-info'
> and look in the trace buffer to see whether it has anything interesting
> to say.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dynamically switching send-mail settings
  2015-02-09 12:18     ` Tory S. Anderson
  2015-02-18  1:20       ` Lars Ingebrigtsen
@ 2015-04-15 16:08       ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 2015-04-15 16:08 UTC (permalink / raw)
  To: Tory S. Anderson; +Cc: help-gnu-emacs, Robert Thorpe

torys.anderson@gmail.com (Tory S. Anderson) writes:

>     gnutls.c: [audit] Received record packet of unknown type 50
>
>     gnutls.c: [0] (Emacs) fatal error: An unexpected TLS packet was received.
>     gnutls.el: (err=[-15] An unexpected TLS packet was received.)
> boot: (:priority NORMAL :hostname mail.toryanderson2.com :loglevel 1
> :min-prime-bits 256 :trustfiles (/etc/pki/tls/certs/ca-bundle.crt)
> :crlfiles nil :keylist nil :verify-flags nil :verify-error nil
> :callbacks nil)

I don't know what a packet of type 50 is...  Anybody know what this
might be?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Dynamically switching send-mail settings
@ 2024-04-11 19:51 João Pedro
  0 siblings, 0 replies; 7+ messages in thread
From: João Pedro @ 2024-04-11 19:51 UTC (permalink / raw)
  To: torys.anderson; +Cc: Emacs developers

Hi Tory and all,

Do you still remember how you managed to fix this particular issue? I
know its been quite a while, but I've started to get a similar issue
which I supposed is caused by what Lars suggested, that the SMTP server
(Gmail) is closing the connection. I could provide some more details of
my setup to help understand what's going on, but I get the following
message:

gnutls.el: (err=[-15] An unexpected TLS packet was received.) boot: (:priority NORMAL:%DUMBFW :hostname smtp.gmail.com :loglevel 0 :min-prime-bits nil :trustfiles (/etc/ssl/certs/ca-certificates.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)

and, with `smtpmail-debug-info' and `smtpmail-debug-verb' both set to
`t', I get the following messages in the trace buffer:

smtp.gmail.com ESMTP a6-20020a170902ecc600b001e45c0d6ce6sm1531247plh.306 - gsmtp
502-5.5.1 Unrecognized command. For more information, go to
502 5.5.1  https://support.google.com/a/answer/3221692 a6-20020a170902ecc600b001e45c0d6ce6sm1531247plh.306 - gsmtp
...
451-4.4.2 Timeout - closing connection.
451-4.4.2  For more information, go to
451 4.4.2  https://support.google.com/a/answer/3221692 a6-20020a170902ecc600b001e45c0d6ce6sm1531247plh.306 - gsmtp

Process smtpmail<10> connection broken by remote peer

I don't know why it is closing the connection, or how to tell
smtpmail.el to close the connection after some time. It isn't stopping
me from sending emails, but it is quite bothersome to have that popup on
my echo area from time to time...

-- 
João Pedro de A. Paula
IT bachelors at Universidade Federal do Rio Grande do Norte (UFRN)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-11 19:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11 19:51 Dynamically switching send-mail settings João Pedro
  -- strict thread matches above, loose matches on Subject: below --
2015-02-08 21:49 Dynamically switching send-mail settings (WAS: > 24.3 can't send mail) Robert Thorpe
2015-02-09  2:54 ` Dynamically switching send-mail settings Tory S. Anderson
     [not found] ` <mailman.19558.1423450457.1147.help-gnu-emacs@gnu.org>
2015-02-09  5:03   ` Lars Magne Ingebrigtsen
2015-02-09 12:18     ` Tory S. Anderson
2015-02-18  1:20       ` Lars Ingebrigtsen
2015-02-18  2:10         ` Tory S. Anderson
2015-04-15 16:08       ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.