Discussion:
[VM] smtp issues: progress indicator and gracious failure
emacs user
2011-05-20 08:30:19 UTC
Permalink
hi all,

These aren't bug reports, but more like feature requests, in the hope
that these features already exist and I dont know how to activate
them.

I use vm with smtpmail to send mail. when on a slow wireless
connection, sending 20Mb attachments can take over 10 minutes. I am
wondering if there is a way to get some progress indicator, such as a
continuously updating "percent uploaded" in the echo area?

also, smtp fails quite often, and then I am left with the outgoing
mail buffer. I can press c-c c-c to try again and that works in most
cases, but then it adds the message to the outgoing folder again, so I
need to erase the .FCC line by hand. wouldn't it be good if a failed
message was automatically put in "outgoing folder" such as a queued-
mail directory, and then sent at a later time? perhaps when smtpmail
is called again to send another message?

cheers, E
Uday Reddy
2011-05-20 12:08:30 UTC
Permalink
I think smtpmail is a make-shift solution for sending mail from client
machines. You might try experimenting with msmtp, which is a native
program that implements the SMTP protocol for your machine. Here is the
link to the msmtp page:

http://msmtp.sourceforge.net/

Cheers,
Uday
Post by emacs user
hi all,
These aren't bug reports, but more like feature requests, in the hope
that these features already exist and I dont know how to activate
them.
I use vm with smtpmail to send mail. when on a slow wireless
connection, sending 20Mb attachments can take over 10 minutes. I am
wondering if there is a way to get some progress indicator, such as a
continuously updating "percent uploaded" in the echo area?
also, smtp fails quite often, and then I am left with the outgoing
mail buffer. I can press c-c c-c to try again and that works in most
cases, but then it adds the message to the outgoing folder again, so I
need to erase the .FCC line by hand. wouldn't it be good if a failed
message was automatically put in "outgoing folder" such as a queued-
mail directory, and then sent at a later time? perhaps when smtpmail
is called again to send another message?
cheers, E
Stefan Monnier
2011-05-20 12:46:26 UTC
Permalink
Post by emacs user
I use vm with smtpmail to send mail. when on a slow wireless
connection, sending 20Mb attachments can take over 10 minutes. I am
wondering if there is a way to get some progress indicator, such as a
continuously updating "percent uploaded" in the echo area?
You could try the patch below.
Post by emacs user
also, smtp fails quite often, and then I am left with the outgoing
mail buffer.
Do you happen to know why?
Post by emacs user
I can press c-c c-c to try again and that works in most cases, but
then it adds the message to the outgoing folder again, so I need to
erase the .FCC line by hand. wouldn't it be good if a failed message
was automatically put in "outgoing folder" such as a queued- mail
directory, and then sent at a later time? perhaps when smtpmail is
called again to send another message?
That seems to be specific to VM, so I'll let the VM crowd handle it.


Stefan


=== modified file 'lisp/mail/smtpmail.el'
--- lisp/mail/smtpmail.el 2011-02-12 17:51:02 +0000
+++ lisp/mail/smtpmail.el 2011-05-20 12:44:28 +0000
@@ -941,15 +941,20 @@
(process-send-string process "\r\n"))

(defun smtpmail-send-data (process buffer)
- (let ((data-continue t) sending-data)
+ (let ((data-continue t) sending-data
+ (pr (make-progress-reporter "Sending email"
+ (with-current-buffer buffer (point-min))
+ (with-current-buffer buffer (point-max)))))
(with-current-buffer buffer
(goto-char (point-min)))
(while data-continue
(with-current-buffer buffer
+ (progress-reporter-update pr (point))
(setq sending-data (buffer-substring (point-at-bol) (point-at-eol)))
(end-of-line 2)
(setq data-continue (not (eobp))))
- (smtpmail-send-data-1 process sending-data))))
+ (smtpmail-send-data-1 process sending-data))
+ (progress-reporter-done pr)))

(defun smtpmail-deduce-address-list (smtpmail-text-buffer header-start header-end)
"Get address list suitable for smtp RCPT TO: <address>."
emacs user
2011-05-21 06:08:28 UTC
Permalink
Post by Stefan Monnier
I use vm with smtpmail to send mail.  when on a slow wireless
connection, sending 20Mb attachments can take over 10 minutes.  I am
wondering if there is a way to get some progress indicator, such as a
continuously updating "percent uploaded" in the echo area?
You could try the patch below.
also, smtp fails quite often, and then I am left with the outgoing
mail buffer.
Do you happen to know why?
I can press c-c c-c to try again and that works in most cases, but
then it adds the message to the outgoing folder again, so I need to
erase the .FCC line by hand.  wouldn't it be good if a failed message
was automatically put in "outgoing folder" such as a queued- mail
directory, and then sent at a later time?  perhaps when smtpmail is
called again to send another message?
That seems to be specific to VM, so I'll let the VM crowd handle it.
        Stefan
=== modified file 'lisp/mail/smtpmail.el'
--- lisp/mail/smtpmail.el       2011-02-12 17:51:02 +0000
+++ lisp/mail/smtpmail.el       2011-05-20 12:44:28 +0000
thanks, fantastic! what version of emacs can I apply this patch to?
I tried trunk and it failed, although I may have done this
incorrectly. cheers, E
Stefan Monnier
2011-05-22 18:41:28 UTC
Permalink
Post by emacs user
thanks, fantastic! what version of emacs can I apply this patch to?
I tried trunk and it failed, although I may have done this
incorrectly. cheers, E
It's meant to be applied to `trunk' and seems to apply fine for me.
Here it is again, freshly regenerated from trunk, and bundled up in
a MIME attachment.


Stefan
Uday Reddy
2011-05-23 06:50:17 UTC
Permalink
Post by Stefan Monnier
Post by emacs user
I can press c-c c-c to try again and that works in most cases, but
then it adds the message to the outgoing folder again, so I need to
erase the .FCC line by hand. wouldn't it be good if a failed message
was automatically put in "outgoing folder" such as a queued- mail
directory, and then sent at a later time? perhaps when smtpmail is
called again to send another message?
That seems to be specific to VM, so I'll let the VM crowd handle it.
Well, it is not really a VM thing, except to say that VM is still using
mail-mode for sending mail, which is semi-obsolete. mail-mode puts FCC
headers in the message composition buffer and leaves them there until
the message gets sent.

Perhaps moving to message-mode will cure the problem?

Cheers,
Uday
Stefan Monnier
2011-05-23 13:22:11 UTC
Permalink
Post by Uday Reddy
Post by Stefan Monnier
Post by emacs user
I can press c-c c-c to try again and that works in most cases, but
then it adds the message to the outgoing folder again, so I need to
erase the .FCC line by hand. wouldn't it be good if a failed message
was automatically put in "outgoing folder" such as a queued- mail
directory, and then sent at a later time? perhaps when smtpmail is
called again to send another message?
That seems to be specific to VM, so I'll let the VM crowd handle it.
Well, it is not really a VM thing, except to say that VM is still using
mail-mode for sending mail, which is semi-obsolete. mail-mode puts FCC
headers in the message composition buffer and leaves them there until the
message gets sent.
Sounds like we have a bug there, then. I guess "emacs user
Post by Uday Reddy
Perhaps moving to message-mode will cure the problem?
I wouldn't know.


Stefan
emacs user
2011-05-23 05:53:13 UTC
Permalink
Post by Stefan Monnier
It's meant to be applied to `trunk' and seems to apply fine for me.
Here it is again, freshly regenerated from trunk, and bundled up in
a MIME attachment.
Stefan
OK, this worked miraculously well, totally appreciate this, thanks! may be good to put a space between "sending mail" and the percent indicator. cheers, E
emacs user
2011-05-23 12:01:02 UTC
Permalink
Post by Uday Reddy
Post by Stefan Monnier
Post by emacs user
I can press c-c c-c to try again and that works in most cases, but
then it adds the message to the outgoing folder again, so I need to
erase the .FCC line by hand. wouldn't it be good if a failed message
was automatically put in "outgoing folder" such as a queued- mail
directory, and then sent at a later time? perhaps when smtpmail is
called again to send another message?
That seems to be specific to VM, so I'll let the VM crowd handle it.
Well, it is not really a VM thing, except to say that VM is still using
mail-mode for sending mail, which is semi-obsolete. mail-mode puts FCC
headers in the message composition buffer and leaves them there until
the message gets sent.
Perhaps moving to message-mode will cure the problem?
Cheers,
Uday
I'd be happy to try this. Is this done by setting some vm-variable? will all the vm functionality still be there? the manual seems to only indicate that mail mode is used and that it is not too dissimilar from message mode...
Uday Reddy
2011-05-23 15:36:02 UTC
Permalink
Post by emacs user
I'd be happy to try this. Is this done by setting some vm-variable?
Not really. VM needs to be modified to work on top of message-mode. I
have it on my TO-DO list.
Post by emacs user
will all the vm functionality still be there? the manual seems to
only indicate that mail mode is used and that it is not too
dissimilar from message mode...
Yes, when it is done, there should be no visible change, except that
message-mode will probably behave a bit better. We will also be able to
use it to post messages to newsgroups.

Cheers,
Uday
emacs user
2011-05-23 12:06:29 UTC
Permalink
Post by Uday Reddy
http://msmtp.sourceforge.net/
Cheers,
Uday
hi Uday, I think I managed to set this up, although didn't switch yet. one advantage may be that msmtp can get the needed smtp password from a system keyring/ keychain (on mac os x). see

http://msmtp.sourceforge.net/doc/msmtp.html
"Currently supported keyrings are the Gnome Keyring and the Mac OS X Keychain. The script msmtp-gnome-tool.py can be used to manage Gnome Keyring passwords for msmtp. To manage Mac OS X Keychain passwords, use the Keychain Access GUI application. The ‘account name’ is same as the msmtp ‘user’ argument. The ‘keychain item name’ is smtp://<hostname> where <hostname> matches the msmtp ‘host’ argument."

I wonder if this can also be used for incoming imap passwords in vm somehow...
Uday Reddy
2011-05-23 15:39:11 UTC
Permalink
Post by emacs user
hi Uday, I think I managed to set this up, although didn't switch yet. one advantage may be that msmtp can get the needed smtp password from a system keyring/ keychain (on mac os x). see
Ok, that is good. I see no downside to switching to msmtp. So, if you
are able to, please go ahead.
Post by emacs user
"Currently supported keyrings are the Gnome Keyring and the Mac OS X Keychain. The script msmtp-gnome-tool.py can be used to manage Gnome Keyring passwords for msmtp. To manage Mac OS X Keychain passwords, use the Keychain Access GUI application. The ‘account name’ is same as the msmtp ‘user’ argument. The ‘keychain item name’ is smtp://<hostname> where<hostname> matches the msmtp ‘host’ argument."
I wonder if this can also be used for incoming imap passwords in vm somehow...
Well, VM doesn't do password storage on its own, but uses Emacs's
auth-source library. I think Ted Zlatanov has Mac OS X on his TO-DO
list too. Perhaps you can give him a prompt.

Cheers,
Uday

Loading...