help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: smtpmail.el and logging


From: Kevin Rodgers
Subject: Re: smtpmail.el and logging
Date: Fri, 01 Jul 2005 11:00:14 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

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 via email to

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