[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Can't send mail with smtpmail "any more". (Gmail and other providers
Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
Sun, 1 Nov 2020 16:05:01 +0300
Mutt/+ (1036f0e) (2020-10-18)
* Saša Janiška <email@example.com> [2020-11-01 15:35]:
> On Tue, 27 Oct 2020 17:15:56 +0200
> Eli Zaretskii <firstname.lastname@example.org> wrote:
> > smtpmail.el has a debug facility, whereby you can set a variable and
> > get a buffer with the details of the connection session.
> What about adding some regular logging facility to smtpmail.el? It is
> the main reason why I'm using msmtp instead?
> (This email is still sent by Claws until I decide which client to
> use: Gnus or mu4e.)
M-x rmail is quite good client for email handling in Emacs.
Then there is:
M-x mh-rmail which may have many good power users' options
For me, due to nature of my email handling and having over 50000
Maildir directories inside of ~/Maildir and that none of Emacs clients
is handling Maildirs, I am using mutt email client. That is one of
most efficient for me. And I am launching it inside of Emacs and
editing files with Emacs by using emacsclient
(defun mutt-emacs ()
"Opens mutt in ansi-term buffer within GNU Emacs"
(let* ((default-directory (getenv "HOME")))
But my M-x becomes not usable when I am in ansi-term, I would like
that it is usable.
I made this function to open up mutt in vterm and I still use it. But
that was workaround from time when ansi-term was not handling best
some terminal activities. Bugs have been polished and now ansi-term
works just fine.
(defun mutt-vterm ()
"Opens mutt in vterm buffer within GNU Emacs"
(let* ((default-directory (getenv "HOME"))
(buffer-exist (get-buffer "mutt"))
(if (and (not (symbolp last-key))
(not (= last-key 8388717)))
(if (and (not (string-match (buffer-name (current-buffer)) "mutt"))
(y-or-n-p "Buffer `mutt' exists, do you wish to switch?"))
(global-set-key (kbd "s-m") 'mutt-you-name-it)
For fetching emails I recommend using GNU mailtools and setting up
crontab to regularly fetch emails to local computer.
For sending, I recommend using the MTA on the system if such exists on
your system, for example exim, courier MTA, OpenSMTPD, Postfix and
similar. Those are handling the queues well if you have good
connection to Internet.
msmtp is excellent tool and handles queues of email even if connection
to Internet is sporadic. MTAs need to be configured to handled mail in
queues for longer time and for that reason some emails could be lost
or returned back.
I am using those scripts for msmtp, like list queue and similar. So
the script below is at ~/bin/sendmail and my PATH is ~/bin as well so
Emacs will recognize it as sendmail and dispatch email without any
further settings to msmtp. That is very handy when using it with emacs
-Q when one needs to M-x report-emacs-bug
~/bin/sendmail follows below:
# Set secure permissions on created directories and files
# Change to queue directory (create it if necessary)
if [ ! -d "$QUEUEDIR" ]; then
mkdir -p "$QUEUEDIR" || exit 1
cd "$QUEUEDIR" || exit 1
# Create new unique filenames of the form
# MAILFILE: ccyy-mm-dd-hh.mm.ss[-x].mail
# MSMTPFILE: ccyy-mm-dd-hh.mm.ss[-x].msmtp
# where x is a consecutive number only appended if you send more than one
# mail per second.
if [ -f "$BASE.mail" -o -f "$BASE.msmtp" ]; then
while [ -f "$TMP-$i.mail" -o -f "$TMP-$i.msmtp" ]; do
i=`expr $i + 1`
# Write command line to $MSMTPFILE
echo "$@" > "$MSMTPFILE" || exit 1
# Write the mail to $MAILFILE
cat > "$MAILFILE" || exit 1
# If we are online, run the queue immediately.
# Replace the test with something suitable for your site.
ping -c 1 -w 2 stw1.rcdrun.com > /dev/null
if [ $? -eq 0 ]; then
msmtp-runqueue.sh > /dev/null &
Re: Can't send mail with smtpmail "any more". (Gmail and other providers), Vladimir Nikishkin, 2020/11/01
Re: Can't send mail with smtpmail "any more". (Gmail and other providers), Eli Zaretskii, 2020/11/01