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



_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to