emacs-devel
[Top][All Lists]
Advanced

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

Re: Asynchronous DNS


From: Rasmus
Subject: Re: Asynchronous DNS
Date: Mon, 08 Feb 2016 21:30:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

John Wiegley <address@hidden> writes:

>>>>>> Lars Ingebrigtsen <address@hidden> writes:
>
>> Ideally, when you're sending mail with smtpmail.el, it would all happen
>> without Emacs being blocked, right? So that the user can go on reading the
>> next email.
>
> In GNU ELPA, the async package uses async.el to make smtpmail easily
> asynchronous, without any changes to smtpmail.el.

Are you sure?  Last I tried, I think I needed this piece of advice to get
it working.  Even then it was too unreliable for real world usage (as I
recall sometimes I would think emails would have been sent but they
weren’t).

Rasmus

(with-eval-after-load 'message
  (when (require 'smtpmail-async nil t)

    (defcustom rasmus/message-async nil
      "Should messages be send asynchronously?")
    
    (defun async-message-multi-smtp-send-mail (orig-fun &rest args)
      "Make `message-multi-smtp-send-mail' use async-smtp.el"
      (if rasmus/message-async
          (cl-letf (((symbol-function 'message-smtpmail-send-it)
                     #'async-smtpmail-send-it)
                    ;; I don't know if the following function mapping is
                    ;; necessary, but it's what is called from
                    ;; `message-multi-smtp-send-mail', but not from
                    ;; `async-smtpmail-send-it'.
                    ((symbol-function 'smtpmail-send-it)
                     #'message-smtpmail-send-it))
            (apply orig-fun args))
        (apply orig-fun args)))

    (advice-add 'message-multi-smtp-send-mail :around
                #'async-message-multi-smtp-send-mail)))

-- 
Together we will make the possible totalllly impossible!




reply via email to

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