1 Add support for sendbox (primary send path)
3 This patch adds support for Courier IMAP's Outbox feature. It adds the setting
4 "sendbox" which specifies a mailbox to which sent messages should be saved,
5 overriding the sendmail and smtp_url settings. This patch only affects the
6 primary send path, bounce is handled in a follow-on patch.
8 Signed-off-by: Aron Griffis <agrif...@n01se.net>
10 diff -r 4119b2394228 -r a1d30c527520 configure.ac
11 --- a/configure.ac Tue Apr 28 11:17:31 2009 -0400
12 +++ b/configure.ac Tue Apr 28 11:17:31 2009 -0400
15 dnl -- end imap dependencies --
17 +AC_ARG_ENABLE(sendbox, AC_HELP_STRING([--enable-sendbox], [Enable support for Courier-style Outbox]),
18 + [if test $enableval = yes; then
19 + AC_DEFINE(USE_SENDBOX, 1, [Define if you want support for Courier-style Outbox])
22 AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl@<:@=PFX@:>@], [Enable TLS support using OpenSSL]),
23 [ if test "$with_ssl" != "no"
25 diff -r 4119b2394228 -r a1d30c527520 globals.h
26 --- a/globals.h Tue Apr 28 11:17:31 2009 -0400
27 +++ b/globals.h Tue Apr 28 11:17:31 2009 -0400
29 WHERE char *QueryFormat;
31 WHERE short SearchContext;
35 WHERE char *SendCharset;
38 diff -r 4119b2394228 -r a1d30c527520 init.h
39 --- a/init.h Tue Apr 28 11:17:31 2009 -0400
40 +++ b/init.h Tue Apr 28 11:17:31 2009 -0400
41 @@ -2464,6 +2464,18 @@
42 ** In case the text cannot be converted into one of these exactly,
43 ** mutt uses $$charset as a fallback.
46 + { "sendbox", DT_PATH, R_NONE, UL &Sendbox, 0 },
49 + ** Specifies a special mailbox that will
50 + ** \fBsend\fP mail when written. When \fIset\fP, this variable overrides
51 + ** \fIsmtp_url\fP and \fIsendmail\fP.
52 + ** To make use of this, you probably want a Courier IMAP server configured for
54 + ** http://www.inter7.com/courierimap/INSTALL.html#imapsend
57 { "sendmail", DT_PATH, R_NONE, UL &Sendmail, UL SENDMAIL " -oem -oi" },
60 diff -r 4119b2394228 -r a1d30c527520 protos.h
61 --- a/protos.h Tue Apr 28 11:17:31 2009 -0400
62 +++ b/protos.h Tue Apr 28 11:17:31 2009 -0400
64 int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
65 int mutt_save_message (HEADER *, int, int, int, int *);
66 int mutt_search_command (int, int);
68 +int mutt_sendbox_send (HEADER *);
71 int mutt_smtp_send (const ADDRESS *, const ADDRESS *, const ADDRESS *,
72 const ADDRESS *, const char *, int);
73 diff -r 4119b2394228 -r a1d30c527520 send.c
74 --- a/send.c Tue Apr 28 11:17:31 2009 -0400
75 +++ b/send.c Tue Apr 28 11:17:31 2009 -0400
81 + /* Some imap servers can send mail by saving to a special folder.
82 + * In this case, there's no need for the intermediate tempfile because
83 + * we'll write directly to the folder.
86 + return mutt_sendbox_send (msg);
89 /* Write out the message in MIME form. */
90 mutt_mktemp (tempfile, sizeof (tempfile));
91 if ((tempfp = safe_fopen (tempfile, "w")) == NULL)
92 diff -r 4119b2394228 -r a1d30c527520 sendlib.c
93 --- a/sendlib.c Tue Apr 28 11:17:31 2009 -0400
94 +++ b/sendlib.c Tue Apr 28 11:17:31 2009 -0400
95 @@ -2929,3 +2929,30 @@
96 set_noconv_flags (hdr->content, 0);
101 +int mutt_sendbox_send (HEADER *hdr)
103 + struct mutt_message_handle *mh;
106 + short old_write_bcc;
108 + hdr->read = 0; /* make sure to put it in the `new' directory (maildir) */
110 + mh = mutt_start_message (Sendbox, hdr, &ctx, &msg, 0);
114 + /* need to write the bcc in the headers */
115 + old_write_bcc = option (OPTWRITEBCC);
116 + set_option (OPTWRITEBCC);
118 + mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, 0, 0);
120 + if (!old_write_bcc)
121 + unset_option (OPTWRITEBCC);
123 + return mutt_finish_message (mh, Sendbox, hdr, &ctx, &msg, 1);