unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: smtpmail.el and logging
Date: Fri, 01 Jul 2005 11:00:14 -0600	[thread overview]
Message-ID: <da3scn$835$1@sea.gmane.org> (raw)
In-Reply-To: <87fyuy4ioe.fsf@wivenhoe.staff8.ul.ie>

Brendan Halpin wrote:
 > I normally send mail directly from my machine using the MTA, and
 > the access to the logs is handy from time to time.
 >
 > However, some of my correspondents are on sites which won't accept
 > mail except from a machine with a valid MX record, which I don't
 > have. Therefore I sometimes use smtpmail.el, but I miss the
 > logging. Does smtpmail.el log at all? If so, how and where?

I don't understand why those sites would accept a direct SMTP connection
from your machine but not an SMTP connection via sendmail.  In any case,
smtpmail logs each transaction in the *trace of SMTP session to foo*
buffer, where foo is smtpmail-smtp-server.

For example, I've been using this for years:

(defadvice smtpmail-send-it (around display-trace-buffer activate)
   "If an error is signalled, display the process buffer."
   (condition-case signals-data
       ad-do-it
     (error (shrink-window-if-larger-than-buffer
	    (display-buffer (get-buffer (format "*trace of SMTP session to %s*"
						smtpmail-smtp-server))))
	   (signal (car signals-data) (cdr signals-data)))))

You should be able to advise smtpmail-send-it to append the contents of
the trace buffer to a log file:

(defvar smtpmail-log-file nil
   "If non-nil, the name of the SMTP log file.")

(defadvice smtpmail-send-it (after smtpmail-log-file activate)
   "If `smtpmail-log-file' is non-nil, append the contents of the trace 
buffer."
   (when smtpmail-log-file
     (with-current-buffer (get-buffer
                           (format "*trace of SMTP session to %s*"
                                   smtpmail-smtp-server))
       (append-to-file (point-min) (point-max) smtpmail-log-file))))

-- 
Kevin Rodgers

  reply	other threads:[~2005-07-01 17:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01 16:04 smtpmail.el and logging Brendan Halpin
2005-07-01 17:00 ` Kevin Rodgers [this message]
     [not found] ` <mailman.1862.1120237690.2857.help-gnu-emacs@gnu.org>
2005-07-02 15:38   ` Brendan Halpin

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='da3scn$835$1@sea.gmane.org' \
    --to=ihs_4664@yahoo.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).