7 /* log that a message was or could be sent
11 /* int sent(flags, queue_id, stats, recipient, relay, dsn)
13 /* const char *queue_id;
15 /* RECIPIENT *recipient;
19 /* sent() logs that a message was successfully delivered,
20 /* updates the address verification service, or updates a
21 /* message delivery record on request by the sender. The
22 /* flags argument determines the action.
24 /* vsent() implements an alternative interface.
28 /* Zero or more of the following:
31 /* The message is a normal delivery request.
32 /* .IP DEL_REQ_FLAG_MTA_VRFY
33 /* The message is an MTA-requested address verification probe.
34 /* Update the address verification database.
35 /* .IP DEL_REQ_FLAG_USR_VRFY
36 /* The message is a user-requested address expansion probe.
37 /* Update the message delivery record.
38 /* .IP DEL_REQ_FLAG_RECORD
39 /* This is a normal message with logged delivery. Update the
40 /* the message delivery record.
42 /* The message queue id.
44 /* Time stamps from different message delivery stages
45 /* and session reuse count.
47 /* Recipient information. See recipient_list(3).
49 /* Name of the host we're talking to.
51 /* Delivery status. See dsn(3). The action is ignored in case
52 /* of a probe message. Otherwise, "delivered" is assumed when
53 /* no action is specified.
55 /* A non-zero result means the operation failed.
57 /* Fatal: out of memory.
59 /* Should be replaced by routines with an attribute-value based
60 /* interface instead of an interface that uses a rigid argument list.
64 /* The Secure Mailer license must be distributed with this software.
67 /* IBM T.J. Watson Research
69 /* Yorktown Heights, NY 10598, USA
77 /* Utility library. */
84 #include <mail_params.h>
86 #include <log_adhoc.h>
93 /* Application-specific. */
95 /* sent - log that a message was or could be sent */
97 int sent(int flags
, const char *id
, MSG_STATS
*stats
,
98 RECIPIENT
*recipient
, const char *relay
,
107 if (my_dsn
.status
[0] != '2' || !dsn_valid(my_dsn
.status
)) {
108 msg_warn("sent: ignoring dsn code \"%s\"", my_dsn
.status
);
109 my_dsn
.status
= "2.0.0";
113 * MTA-requested address verification information is stored in the verify
116 if (flags
& DEL_REQ_FLAG_MTA_VRFY
) {
117 my_dsn
.action
= "deliverable";
118 status
= verify_append(id
, stats
, recipient
, relay
, &my_dsn
,
124 * User-requested address verification information is logged and mailed
125 * to the requesting user.
127 if (flags
& DEL_REQ_FLAG_USR_VRFY
) {
128 my_dsn
.action
= "deliverable";
129 status
= trace_append(flags
, id
, stats
, recipient
, relay
, &my_dsn
);
134 * Normal mail delivery. May also send a delivery record to the user.
137 if (my_dsn
.action
== 0 || my_dsn
.action
[0] == 0)
138 my_dsn
.action
= "delivered";
140 if (((flags
& DEL_REQ_FLAG_RECORD
) == 0
141 || trace_append(flags
, id
, stats
, recipient
, relay
, &my_dsn
) == 0)
142 && ((recipient
->dsn_notify
& DSN_NOTIFY_SUCCESS
) == 0
143 || trace_append(flags
, id
, stats
, recipient
, relay
, &my_dsn
) == 0)) {
144 log_adhoc(id
, stats
, recipient
, relay
, &my_dsn
, "sent");
147 VSTRING
*junk
= vstring_alloc(100);
149 vstring_sprintf(junk
, "%s: %s service failed",
150 id
, var_trace_service
);
151 my_dsn
.reason
= vstring_str(junk
);
152 my_dsn
.status
="4.3.0";
153 status
= defer_append(flags
, id
, stats
, recipient
, relay
, &my_dsn
);