Sam Varshavchik writes:
Alexei Batyr' writes:Sam Varshavchik writes:This will work if you drop the Content-Transfer-Encoding header from your autoreply text, and if you use the -m option, not -t.This header was generated by Sqwebmail's autoreply constructor and inaccessible for webmail user. Filter rule also generated by Sqwebmail and contains -m option:if (!(/^X-Spam-Status: *Yes/)) { AUTOREPLYFROM="$FROM"`/mail/courier/bin/mailbot -A "X-Sender: $FROM" -A "From: $AUTOREPLYFROM" -m "./Maildir/autoresponses/1" $SENDMAIL -t -f ""` }Ok, so the -m option is specified. I'll look into it.
Ok, you showed two issues -- a duplicate Content-Transfer-Encoding: header, and an encoding error. The duplicate header is easy to understand, but I do not understand where your encoding issue came from.
Your autoreply text specified the utf-8 character set. The received message was utf-8, and the generated autoreply was also utf-8. When I try to reproduce your test case, I get everything encoded correctly, except for the dupe Content-Transfer-Encoding: header which is a separate issue.
I suspect that you showed the wrong sample message. I believe that your encoding problem occurs when the original message uses a different encoding than the autoreply text.
Can you try applying the following patch to mailbot, and see if it fixes both problems. I'll need to document the fact that autoreplies in webmail should be set up with a browser that supports utf-8. This patch transcodes the original message to the character set specified in the autoreply text, so the autoreply text should be specified in utf-8 in order to be able to transcode any character set to it.
Index: maildrop/mailbot.c
===================================================================
RCS file: /cvsroot/courier/courier/maildrop/maildrop/mailbot.c,v
retrieving revision 1.19
diff -U3 -r1.19 mailbot.c
--- maildrop/mailbot.c 16 Aug 2010 02:49:11 -0000 1.19
+++ maildrop/mailbot.c 16 Sep 2010 00:49:11 -0000
@@ -462,11 +462,16 @@
struct mimeautoreply_s *p=(struct mimeautoreply_s *)ptr;
char buf[BUFSIZ];
+ static const char ct[]="Content-Transfer-Encoding:";
+
while (fgets(buf, sizeof(buf), p->contentf) != NULL)
{
if (buf[0] == '\n')
break;
+ if (strncasecmp(buf, ct, sizeof(ct)-1) == 0)
+ continue;
+
mimeautoreply_write_func(buf, strlen(buf), ptr);
while (strchr(buf, '\n') == NULL)
@@ -744,6 +749,51 @@
exit(1);
}
+ {
+ struct rfc2045 *rfcp=rfc2045_alloc();
+ static const char mv[]="Mime-Version: 1.0\n";
+ char buf[BUFSIZ];
+ int l;
+ const char *content_type;
+ const char *content_transfer_encoding;
+ const char *charset;
+
+ rfc2045_parse(rfcp, mv, sizeof(mv)-1);
+
+ while ((l=fread(buf, 1, sizeof(buf), replyinfo.contentf)
+ ) > 0)
+ {
+ rfc2045_parse(rfcp, buf, l);
+ }
+
+ if (l < 0 ||
+ fseek(replyinfo.contentf, 0L, SEEK_SET) < 0)
+ {
+ perror(mimefile);
+ exit(1);
+ }
+
+ rfc2045_mimeinfo(rfcp, &content_type,
+ &content_transfer_encoding,
+ &charset);
+
+ if (strcasecmp(content_type, "text/plain"))
+ {
+ fprintf(stderr,
+ "%s must specify text/plain MIME
type\n",
+ mimefile);
+ exit(1);
+ }
+ if (charset == NULL ||
+ (uinfo=unicode_find(charset)) == NULL)
+ {
+ fprintf(stderr, "Unknown charset in %s\n",
+ mimefile);
+ exit(1);
+ }
+ replyinfo.info.charset=uinfo->chset;
+ rfc2045_free(rfcp);
+ }
replyinfo.info.content_set_charset=copy_headers;
replyinfo.info.content_specify=copy_body;
}
pgpZKDCkhCUIJ.pgp
Description: PGP signature
------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________ courier-users mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
