all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: "Saša Janiška" <gour@atmarama.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Can't send mail with smtpmail "any more". (Gmail and other providers)
Date: Sun, 1 Nov 2020 16:05:01 +0300	[thread overview]
Message-ID: <X56yffUI73E7jc81@protected.rcdrun.com> (raw)
In-Reply-To: <20201101133443.3a81f3af@atmarama.ddns.net>

* Saša Janiška <gour@atmarama.com> [2020-11-01 15:35]:
> On Tue, 27 Oct 2020 17:15:56 +0200
> Eli Zaretskii <eliz@gnu.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"
  (interactive)
  (let* ((default-directory (getenv "HOME")))
    (ansi-term "mutt")))

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"
  (interactive)
  (let* ((default-directory (getenv "HOME"))
	 (buffer-exist (get-buffer "mutt"))
	 (vterm-kill-buffer-on-exit t)
	 (vterm-shell "mutt")
	 (last-key (last-key)))
    (if buffer-exist
	(if (and (not (symbolp last-key))
		 (not (= last-key 8388717)))
	    (vterm "mutt")
	  (if (and (not (string-match (buffer-name (current-buffer)) "mutt"))
		   (y-or-n-p "Buffer `mutt' exists, do you wish to switch?"))
	      (switch-to-buffer "mutt")))
      (vterm "mutt"))))

(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:

#!/usr/bin/env bash

QUEUEDIR=$HOME/.msmtpqueue

# Set secure permissions on created directories and files
umask 077

# Change to queue directory (create it if necessary)
if [ ! -d "$QUEUEDIR" ]; then
	mkdir -p "$QUEUEDIR" || exit 1
fi
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.
BASE="`/bin/date +%Y-%m-%d-%H.%M.%S`"
if [ -f "$BASE.mail" -o -f "$BASE.msmtp" ]; then
	TMP="$BASE"
	i=1
	while [ -f "$TMP-$i.mail" -o -f "$TMP-$i.msmtp" ]; do
		i=`expr $i + 1`
	done
	BASE="$BASE-$i"
fi
MAILFILE="$BASE.mail"
MSMTPFILE="$BASE.msmtp"

# 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 &
fi

exit 0



  reply	other threads:[~2020-11-01 13:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27  4:49 Can't send mail with smtpmail "any more". (Gmail and other providers) Vladimir Nikishkin
2020-10-27 15:15 ` Eli Zaretskii
     [not found]   ` <CA+A2iZbz7Z_ma2NBCFYq8rvfCiFB4d0X1+w9=0rSeByCeQDr1g@mail.gmail.com>
2020-10-27 15:45     ` Vladimir Nikishkin
2020-10-27 16:02       ` Robert Pluim
2020-11-01 12:34   ` Saša Janiška
2020-11-01 13:05     ` Jean Louis [this message]
2020-11-01 13:30       ` Can't send mail with smtpmail "any more" " Saša Janiška
2020-11-01 15:30         ` Jean Louis
2020-11-01 19:03           ` Saša Janiška
2020-11-01 21:19             ` Jean Louis
2020-11-02 12:27               ` Saša Janiška
2020-11-01 15:20       ` Can't send mail with smtpmail "any more". " Vladimir Nikishkin
2020-11-02  9:36         ` notmuch or mu for Emacs - " Jean Louis
2020-11-01 15:24     ` Eli Zaretskii
2020-11-01 19:05       ` Saša Janiška
2020-11-01 19:39         ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2020-10-27  3:39 Vladimir Nikishkin
2020-10-27  4:19 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-10-27  4:51   ` Vladimir Nikishkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X56yffUI73E7jc81@protected.rcdrun.com \
    --to=bugs@gnu.support \
    --cc=gour@atmarama.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.