4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
24 * Copyright 2014 Joyent, Inc.
28 * Copyright 1998 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
32 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
33 /* All Rights Reserved */
37 * University Copyright- Copyright (c) 1982, 1986, 1988
38 * The Regents of the University of California
41 * University Acknowledgment- Portions of this document are derived from
42 * software developed by the University of California, Berkeley, and its
50 static int icsubstr(char *s1
, char *s2
);
53 receipt(struct message
*mp
)
61 if ((mail
= value("sendmail")) == 0)
67 if (icsubstr(hfield("default-options", mp
, addone
), "/receipt")
68 || icsubstr(hfield(">to", mp
, addto
), "/receipt")) {
69 snprintf(buf
, sizeof (buf
), "%s %s", mail
, skin(nameof(mp
)));
70 if (pp
= npopen(buf
, "w")) {
73 if (headline_alloc(&hl
) != 0) {
74 err(1, "could not allocate memory");
79 if (parse_headline(head
, hl
) != 0) {
82 if (custr_len(hl
->hl_date
) > 0) {
83 fprintf(pp
, "Original-Date: %s\n",
84 custr_cstr(hl
->hl_date
));
86 if (s
= hfield("message-id", mp
, addone
))
87 fprintf(pp
, "Original-Message-ID: %s\n", s
);
88 s
= hfield("subject", mp
, addone
);
89 fprintf(pp
, "Subject: RR: %s\n", s
? s
: "(none)");
97 icsubstr(char *s1
, char *s2
)
102 istrcpy(buf
, sizeof (buf
), s1
);
103 return substr(buf
, s2
) != -1;