[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Solved (Re: [bug-mailutils] Adding subject in msg-send.c)
From: |
Kidong Lee |
Subject: |
Solved (Re: [bug-mailutils] Adding subject in msg-send.c) |
Date: |
Fri, 7 Mar 2003 13:23:35 +0900 |
User-agent: |
Mutt/1.4i |
On Fri, Mar 07, 2003 at 09:59:29AM +0900, Kidong Lee wrote:
> On Thu, Mar 06, 2003 at 05:15:42PM +0900, Kidong Lee wrote:
> > Hello,
> >
> > When I try to add Subject header in examples/msg-send.c(see diff file),
> > But there's no Subject header in the received mail.(The patch has no
> > effect.)
> > On the contrary, When I comment out message_set_stream()(at 121 line,
> > version 0.3), there's Subject header in the mail.(In this case, there's
> > no body, of course)
> >
> > There seems to be some kind of conflict between message_set_stream() and
> > message_set_header().
> >
> > Is it bug? or is there any fault?
> >
> > ---------------
> >
> > $ diff msg-send.c.orig msg-send.c
> > 69a70
> > > header_t hdr = 0;
> > 120d120
> > < C (message_set_stream (msg, in, NULL));
> > 121a122,125
> > >
> > > C (header_create (&hdr, NULL, 0, msg));
> > > C (header_set_value (hdr, "Subject", "subject test", 1));
> > > C (message_set_header(msg, hdr, NULL));
> >
>
> I made mistake in attaching diff file
> There's correct diff file.
>
> ----------------
>
> $ diff msg-send.c.orig msg-send.c
> 69a70
> > header_t hdr = 0;
> 121a123,126
> >
> > C (header_create (&hdr, NULL, 0, msg));
> > C (header_set_value (hdr, "Subject", "subject test", 1));
> > C (message_set_header(msg, hdr, NULL));
>
I solve the problem.
I added a feature that add Subject and X-Mailer header in mail.
The following is the patch of msg-send.c
$ diff msg-send.c.orig msg-send.c
34a35
> #include <mailutils/header.h>
45c46
< "usage: mailer [-hd] [-m mailer] [-f from] [to]..."
---
> "usage: mailer [-hd] [-m mailer] [-f from] [-s subject] [to]..."
50a52
> " -s subject\n"
63a66
> char *optsubject = "(NO SUBJECT)";
69a73,74
> header_t hdr = 0;
> body_t body = 0;
71c76
< while ((opt = getopt (argc, argv, "hdm:f:")) != -1)
---
> while ((opt = getopt (argc, argv, "hdm:f:s:")) != -1)
90a96,99
> case 's':
> optsubject = optarg;
> break;
>
120c129,138
< C (message_set_stream (msg, in, NULL));
---
>
> C (header_create (&hdr, NULL, 0, msg));
> C (header_set_value (hdr, MU_HEADER_SUBJECT, optsubject, 1));
> C (header_set_value (hdr, "X-Mailer", "GNU Mailutils msg-send", 1));
> C (message_set_header(msg, hdr, NULL));
>
> C (body_create (&body, msg));
> C (body_set_stream (body, in, msg));
> C (message_set_body (msg, body, NULL));
>