Mercurial > hg > mlmmj
annotate src/send_help.c @ 741:b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
and document \uNNNN substitution
Also, the interface to prepstdreply() has changed; there is no longer a
customheaders argument, which was never used anyway, and is now essentially
redundant due to this patch.
author | Ben Schmidt |
---|---|
date | Mon, 20 Sep 2010 01:44:58 +1000 |
parents | c26e97a2207b |
children | c3ee2bfaeb02 |
rev | line source |
---|---|
0 | 1 /* Copyright (C) 2003 Mads Martin Joergensen <mmj at mmj.dk> |
2 * | |
3 * $Id$ | |
4 * | |
225 | 5 * Permission is hereby granted, free of charge, to any person obtaining a copy |
6 * of this software and associated documentation files (the "Software"), to | |
7 * deal in the Software without restriction, including without limitation the | |
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | |
9 * sell copies of the Software, and to permit persons to whom the Software is | |
10 * furnished to do so, subject to the following conditions: | |
11 * | |
12 * The above copyright notice and this permission notice shall be included in | |
13 * all copies or substantial portions of the Software. | |
14 * | |
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
21 * IN THE SOFTWARE. | |
0 | 22 */ |
23 | |
24 #include <stdio.h> | |
25 #include <stdlib.h> | |
26 #include <string.h> | |
25 | 27 #include <unistd.h> |
171 | 28 #include <fcntl.h> |
29 #include <sys/types.h> | |
30 #include <sys/stat.h> | |
0 | 31 |
32 #include "mlmmj.h" | |
33 #include "send_help.h" | |
34 #include "strgen.h" | |
35 #include "find_email_adr.h" | |
36 #include "getlistaddr.h" | |
520 | 37 #include "getlistdelim.h" |
25 | 38 #include "log_error.h" |
171 | 39 #include "chomp.h" |
40 #include "wrappers.h" | |
41 #include "mygetline.h" | |
189
cb46caab2621
New function to prepare a standard mail in an easy way, and make send_help
mmj
parents:
184
diff
changeset
|
42 #include "prepstdreply.h" |
245 | 43 #include "memory.h" |
0 | 44 |
37 | 45 void send_help(const char *listdir, const char *emailaddr, |
609
56785a0b38b6
changed send_help() to accept the name and textfile as arguments (Henne Vogelsang)
mortenp
parents:
553
diff
changeset
|
46 const char *mlmmjsend, const char *name, const char *textfile) |
0 | 47 { |
520 | 48 char *queuefilename, *listaddr, *listdelim, *listname, *listfqdn; |
49 char *fromaddr; | |
0 | 50 |
359
ca217febcfbd
Rerwrite the way listtexts are handled and move Subject: out into the file
mmj
parents:
312
diff
changeset
|
51 listaddr = getlistaddr(listdir); |
520 | 52 listdelim = getlistdelim(listdir); |
0 | 53 listname = genlistname(listaddr); |
54 listfqdn = genlistfqdn(listaddr); | |
55 | |
520 | 56 fromaddr = concatstr(4, listname, listdelim, "bounces-help@", listfqdn); |
57 myfree(listdelim); | |
171 | 58 |
609
56785a0b38b6
changed send_help() to accept the name and textfile as arguments (Henne Vogelsang)
mortenp
parents:
553
diff
changeset
|
59 queuefilename = prepstdreply(listdir, textfile, "$listowner$", |
741
b72bcb7e08a2
Arbitrary headers in listtexts, fix default Content-Transfer-Encoding: header,
Ben Schmidt
parents:
660
diff
changeset
|
60 emailaddr, NULL, 0, NULL, NULL); |
189
cb46caab2621
New function to prepare a standard mail in an easy way, and make send_help
mmj
parents:
184
diff
changeset
|
61 if(queuefilename == NULL) { |
609
56785a0b38b6
changed send_help() to accept the name and textfile as arguments (Henne Vogelsang)
mortenp
parents:
553
diff
changeset
|
62 log_error(LOG_ARGS, "Could not prepare %s mail", name); |
171 | 63 exit(EXIT_FAILURE); |
64 } | |
0 | 65 |
245 | 66 myfree(listaddr); |
67 myfree(listname); | |
68 myfree(listfqdn); | |
0 | 69 |
37 | 70 execlp(mlmmjsend, mlmmjsend, |
122 | 71 "-l", "1", |
529
d65b467b647d
Pass on listdir to mlmmjsend so we can get the smtpport and relayhost also
mmj
parents:
520
diff
changeset
|
72 "-L", listdir, |
0 | 73 "-T", emailaddr, |
74 "-F", fromaddr, | |
435 | 75 "-m", queuefilename, (char *)NULL); |
189
cb46caab2621
New function to prepare a standard mail in an easy way, and make send_help
mmj
parents:
184
diff
changeset
|
76 |
39 | 77 log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend); |
0 | 78 exit(EXIT_FAILURE); |
79 } |