Subject: tmail/sendmail integration

From: Sebastian Hagedorn <[email-masked]>
Date: Fri, 17 Oct 2003 17:54:04 +0200

Hi,

I wonder if anybody can help me with this. Using imap-2002e I'm trying to 
setup sendmail with tmail in such a way that an mbx format INBOX will be 
created automatically if it isn't there. Here's what I've tried.

In the new spirit of sendmail I edited an .mc file with the following 
options:

define(`LOCAL_MAILER_PATH', `/opt/UW-imap/sbin/tmail')
define(`LOCAL_MAILER_ARGS',`tmail -I "#driver.mbx/INBOX" $u')
MODIFY_MAILER_FLAGS(`LOCAL', `-Sh9f')
MODIFY_MAILER_FLAGS(`LOCAL', `+r')

This results in the following Mlocal declaration:

Mlocal,         P=/opt/UW-imap/sbin/tmail, F=lsDFMAw5:/|@qPnr, 
S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
                C=ISO-8859-15, T=DNS/RFC822/X-Unix,
                A=tmail -I "#driver.mbx/INBOX" $u

Note the -I flag passed to tmail! When I try to deliver mail this way, I 
always get the error "missing argument to -I". Here's some debugging output 
from sendmail:

openmailer: MCI@80fd480: flags=0,
        errno=104, herrno=0, exitstat=75, state=0, pid=22971,
        maxsize=0, phase=client greeting, mailer=local,
        status=4.4.2, rstatus=NULL,
        host=NULL, lastuse=Fri Oct 17 17:30:14 2003

The only way I've found to deliver to an mbx format INBOX is to change the 
declaration to

define(`LOCAL_MAILER_ARGS',`tmail  $u')

and to create the INBOX in advance.

Is that really how it is or have I overlooked anything?

Thanks, Sebastian
-- 
Sebastian Hagedorn		PGP key ID: 0x4D105B45
Ehrenfeldgürtel 156
50823 Köln
http://www.spinfo.uni-koeln.de/~hgd/
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Fri, 17 Oct 2003 09:53:55 -0700 (PDT)

>                 A=tmail -I "#driver.mbx/INBOX" $u

Why not just build c-client with CREATEPROTO=mbxdriver instead of the
default CREATEPROTO=unixdriver?

Then tmail (and anything else using c-client) will always create mailboxes
in mbx format by default, and you don't have to worry about getting -I set
right.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

---

From: Sebastian Hagedorn <[email-masked]>
Date: Fri, 17 Oct 2003 19:20:58 +0200

Hi Mark,

> default CREATEPROTO=unixdriver?

because unfortunately that doesn't work:

Oct 17 19:16:50 kerberos sendmail[23152]: h9HHGmx23152: from=root, size=10, 
class=0, nrcpts=1, msg
id=<[email-masked]>, 
relay=root@localhost
Oct 17 19:16:50 kerberos tmail[23156]: tmail called with LF-only newlines
Oct 17 19:16:50 kerberos tmail[23156]: delivering to hgd+INBOX
Oct 17 19:16:50 kerberos tmail[23156]: Verifying safe delivery to 
/var/spool/mail/hgd by UID 20022
Oct 17 19:16:50 kerberos tmail[23156]: unix appending to INBOX (file 
/var/spool/mail/hgd)
Oct 17 19:16:50 kerberos tmail[23156]: delivered to /var/spool/mail/hgd
Oct 17 19:16:50 kerberos tmail[23156]: Verifying safe delivery to 
/var/spool/mail/hgd by UID 20022
Oct 17 19:16:50 kerberos tmail[23156]: all recipients delivered
Oct 17 19:16:50 kerberos sendmail[23155]: h9HHGmx23152: to=hgd, 
ctladdr=root (0/0), delay=00:00:02
, xdelay=00:00:00, mailer=local, pri=30010, dsn=2.0.0, stat=Sent

> in mbx format by default, and you don't have to worry about getting -I set

I wish ...

---

From: Mark Crispin <[email-masked]>
Date: Fri, 17 Oct 2003 10:40:55 -0700 (PDT)

> Oct 17 19:16:50 kerberos tmail[23156]: tmail called with LF-only newlines

;; This is something that you need to fix.  Are you setting E=\r\n?

> /var/spool/mail/hgd by UID 20022

That's because a /var/spool/mail/hgd traditional UNIX format INBOX exists.
tmail won't create an INBOX if there already is an existing one.

-- Mark --

---

From: Sebastian Hagedorn <[email-masked]>
Date: Fri, 17 Oct 2003 20:03:08 +0200

Hi Mark,

> ;; This is something that you need to fix.  Are you setting E=\r\n?

oops, no, I didn't. I fixed that, but it was hard to do (you can't use the 
m4 macros) and the current, third edition of the bat book has this to say 
on pg. 729:

"Delivery agents that do not speak SMTP (those that include a $u in the A= 
argument array) should have their end-of-line field set to E=\n (for a lone 
line-feed character)."

That's not an RFC, but you might want to consider changing that requirement.

> tmail won't create an INBOX if there already is an existing one.

Oh, I see. But that only leads to the next problem:

Oct 17 19:53:10 kerberos sendmail[23300]: h9HHr8J23300: from=root, size=10, 
class=0, nrcpts=1, 
msgid=<[email-masked]>, 
relay=root@localhost
Oct 17 19:53:10 kerberos tmail[23304]: delivering to hgd+INBOX
Oct 17 19:53:10 kerberos tmail[23304]: attempting to create mailbox 
#driver.mbx/INBOX path /home/hgd/mail/INBOX
Oct 17 19:53:10 kerberos tmail[23304]: Can't create /home/hgd/mail/INBOX: 
invalid name
Oct 17 19:53:10 kerberos tmail[23304]: can't create INBOX
Oct 17 19:53:10 kerberos tmail[23304]: error in delivery
Oct 17 19:53:10 kerberos sendmail[23303]: h9HHr8J23300: to=hgd, 
ctladdr=root (0/0), delay=00:00:02, xdelay=00:00:00, mailer=local, 
pri=30010, dsn=4.0.0, stat=Deferred: local mailer (/opt/UW-imap/sbin/tmail) 
exited with EX_TEMPFAIL

I should explain that I set

static char *mailsubdir = "mail";

in env_unix.c, but that's not the issue, is it? /home/hgd/mail does exist, 
btw. The error is the same if I remove it.

Thanks, Sebastian

---

From: Sebastian Hagedorn <[email-masked]>
Date: Fri, 17 Oct 2003 20:22:56 +0200

--On Freitag, 17. Oktober 2003 11:12 Uhr -0700 Steve Hubert 
<[email-masked]> wrote:

>> oops, no, I didn't. I fixed that, but it was hard to do (you can't use
>> the m4 macros) and the current, third edition of the bat book has this
>> to say on pg. 729:
>
> Only responding to the narrow point above,
>
>   define(`LOCAL_MAILER_EOL', `\r\n')

Thanks, I overlooked that one.

Cheers, Sebastian

---

From: Mark Crispin <[email-masked]>
Date: Fri, 17 Oct 2003 11:34:07 -0700 (PDT)

> argument array) should have their end-of-line field set to E=\n (for a lone

That statement must assume that all mailboxes on UNIX use UNIX-style
LF-only newlines.  That is not the case with mbx format, and therefore
does not apply to mbx format.  Or rather, consider that tmail's
requirements supercede anything that the bat book says.

> Oct 17 19:53:10 kerberos tmail[23304]: Can't create /home/hgd/mail/INBOX:

Are you setting any of the restrictBox options (or using a third-party
distribution that sets a restrictBox option)?  If so, unset it.

-- Mark --

---

From: Sebastian Hagedorn <[email-masked]>
Date: Fri, 17 Oct 2003 20:53:49 +0200

Hi Mark,

--On Freitag, 17. Oktober 2003 11:34 Uhr -0700 Mark Crispin 
<[email-masked]> wrote:

>> "Delivery agents that do not speak SMTP (those that include a $u in the
>> A= argument array) should have their end-of-line field set to E=\n (for
>> a lone line-feed character)."
>

fair enough. With the hint that Steve Hubert gave me I'm a happy camper.

>> # driver.mbx/INBOX path /home/hgd/mail/INBOX

OK, that finally did the trick. I gather I'm fine using imapd and ipop3d 
compiled *with* restrictBox together with tmail compiled *without* it?

Thanks very much for your help.
-- 
Sebastian Hagedorn		PGP key ID: 0x4D105B45
Ehrenfeldgürtel 156
50823 Köln
http://www.spinfo.uni-koeln.de/~hgd/

---

From: Mark Crispin <[email-masked]>
Date: Fri, 17 Oct 2003 13:23:20 -0700 (Pacific Daylight Time)

> fair enough. With the hint that Steve Hubert gave me I'm a happy camper.

Great, thanks.

> compiled *with* restrictBox together with tmail compiled *without* it?

Yes, you'll be fine.

Today's imap-2003 development snapshot tarball has the bugfix to this
problem, so in the future you won't have to tweak restrictBox specially
for tmail.

-- Mark --