From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/57032 Path: main.gmane.org!not-for-mail From: Kevin Greiner Newsgroups: gmane.emacs.gnus.general Subject: Re: message-send-mail-function, agent, and a day of work Date: Thu, 15 Apr 2004 12:20:31 -0500 Sender: ding-owner@lists.math.uh.edu Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1082049706 17276 80.91.224.253 (15 Apr 2004 17:21:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 15 Apr 2004 17:21:46 +0000 (UTC) Original-X-From: ding-owner+M5572@lists.math.uh.edu Thu Apr 15 19:21:20 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BEAYC-0000E6-00 for ; Thu, 15 Apr 2004 19:21:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1BEAXm-0000Tb-00; Thu, 15 Apr 2004 12:20:54 -0500 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1BEAXi-0000TW-00 for ding@lists.math.uh.edu; Thu, 15 Apr 2004 12:20:50 -0500 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by util2.math.uh.edu with esmtp (Exim 4.30) id 1BEAXh-0003Em-HV for ding@lists.math.uh.edu; Thu, 15 Apr 2004 12:20:49 -0500 Original-Received: from quimby.gnus.org (quimby.gnus.org [80.91.224.244]) by justine.libertine.org (Postfix) with ESMTP id E1B153A0035 for ; Thu, 15 Apr 2004 12:20:48 -0500 (CDT) Original-Received: from news by quimby.gnus.org with local (Exim 3.35 #1 (Debian)) id 1BEAXg-00077v-00 for ; Thu, 15 Apr 2004 19:20:48 +0200 Original-To: ding@gnus.org Original-Path: not-for-mail Original-Newsgroups: gnus.ding Original-Lines: 87 Original-NNTP-Posting-Host: h-66-134-21-51.hstqtx02.covad.net Original-X-Trace: quimby.gnus.org 1082049648 27398 66.134.21.51 (15 Apr 2004 17:20:48 GMT) Original-X-Complaints-To: usenet@quimby.gnus.org Original-NNTP-Posting-Date: Thu, 15 Apr 2004 17:20:48 +0000 (UTC) User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:8xG9nImGaFdU/b+snO/hetgpUxU= Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:57032 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:57032 Wes Hardaker writes: > I spent way too much time the other day figuring out why my simple > code to switch smtp servers was not working and all. I was properly > setting every variable I could find documented, but the effect seemed > to be nothing. The end result was because I was running with the > agent turned on, I was missing a variable that is not documented with > the rest of them (which makes some sense, as all the agents stuff is > in one place). > > The problem is essentially this: > > 1) when you read about sending mail, the documentation says that the > variable 'message-send-mail-function is consulted to figure out how > to send mail. This is what I was trying to modify. > > 2) However, the agent has his own variable for what to do when sending > anything: gnus-agent-send-mail-function. > > The problem is twofold: first, there is no reference to the second > variable in least a warning in the documentation related to sending > mail. Since the agent is turned on by default now, this will likely > confuse a lot of people. Second, the second variable is independent > of the first. This is part of the confusion. I think the most simple > solution would be to make the second variable point to a different > function which checks the value of the first variable and uses that > at runtime. By default they both point at the same value, however, if > the first one changes the second one never picks up that change in > value. > > The gnus-agent-send-mail-function variable is set in gnus-agentize as > follows: > > (unless gnus-agent-send-mail-function > (setq gnus-agent-send-mail-function > (or message-send-mail-real-function > message-send-mail-function) > message-send-mail-real-function 'gnus-agent-send-mail)) > > I'm suggesting this would be better: > > (defun gnus-agent-use-current-send-mail-function () > (funcall (or message-send-mail-real-function > message-send-mail-function))) > > (unless gnus-agent-send-mail-function > (setq gnus-agent-send-mail-function > 'gnus-agent-use-current-send-mail-function)) > > This way dynamic changes to the message-send-mail-function are picked > up, but it still allows for customization of the agent specifically if > desired. > > Thoughts? The setq that assigns gnus-agent-send-mail-function must also assign message-send-mail-real-function so that the mail functions will be redirected to gnus-agent-send-mail. Since you left that out, the agent's ability to queue mail for later transmission is lost. If we simply restore the missing assignment, we get an infinite loop as gnus-agent-send-function calls gnus-agent-use-current-send-mail-function which funcalls message-send-mail-real-function (i.e. gnus-agent-send-mail). Your configuration shouldn't be changing message-send-mail-real-function so gnus-agent-use-current-send-mail-function could be re-written to just funcall message-send-mail-function. Hmmm.... This should work but it means that the agent will ignore the initial value of message-send-mail-real-function. Not at all sure if that is the right thing to do. (defun gnus-agent-use-current-send-mail-function () (funcall message-send-mail-function)) (unless gnus-agent-send-mail-function (setq gnus-agent-send-mail-function 'gnus-agent-use-current-send-mail-function message-send-mail-real-function 'gnus-agent-send-mail)) Now, one question, are you writing your smtp switch logic into the function called by message-send-mail-function? I believe that you must, if you want offline mail to also be send via multiple smtp servers. Kevin