Postfix3.3.1
qmgr_bounce.c
[詳解]
1 /*++
2 /* NAME
3 /* qmgr_bounce
4 /* SUMMARY
5 /* deal with mail that will not be delivered
6 /* SYNOPSIS
7 /* #include "qmgr.h"
8 /*
9 /* QMGR_QUEUE *qmgr_bounce_recipient(message, recipient, dsn)
10 /* QMGR_MESSAGE *message;
11 /* RECIPIENT *recipient;
12 /* DSN *dsn;
13 /* DESCRIPTION
14 /* qmgr_bounce_recipient() produces a bounce log record.
15 /* Once the bounce record is written successfully, the recipient
16 /* is marked as done. When the bounce record cannot be written,
17 /* the message structure is updated to reflect that the mail is
18 /* deferred.
19 /*
20 /* Arguments:
21 /* .IP message
22 /* Open queue file with the message being bounced.
23 /* .IP recipient
24 /* The recipient that will not be delivered.
25 /* .IP dsn
26 /* Delivery status information. See dsn(3).
27 /* DIAGNOSTICS
28 /* Panic: consistency check failure. Fatal: out of memory.
29 /* LICENSE
30 /* .ad
31 /* .fi
32 /* The Secure Mailer license must be distributed with this software.
33 /* AUTHOR(S)
34 /* Wietse Venema
35 /* IBM T.J. Watson Research
36 /* P.O. Box 704
37 /* Yorktown Heights, NY 10598, USA
38 /*--*/
39 
40 /* System library. */
41 
42 #include <sys_defs.h>
43 
44 /* Utility library. */
45 
46 /* Global library. */
47 
48 #include <bounce.h>
49 #include <deliver_completed.h>
50 
51 /* Application-specific. */
52 
53 #include "qmgr.h"
54 
55 /* qmgr_bounce_recipient - bounce one message recipient */
56 
57 void qmgr_bounce_recipient(QMGR_MESSAGE *message, RECIPIENT *recipient,
58  DSN *dsn)
59 {
60  MSG_STATS stats;
61  int status;
62 
63  status = bounce_append(message->tflags, message->queue_id,
64  QMGR_MSG_STATS(&stats, message), recipient,
65  "none", dsn);
66 
67  if (status == 0)
68  deliver_completed(message->fp, recipient->offset);
69  else
70  message->flags |= status;
71 }
char * queue_id
Definition: qmgr.h:298
void deliver_completed(VSTREAM *stream, long offset)
int bounce_append(int flags, const char *id, MSG_STATS *stats, RECIPIENT *rcpt, const char *relay, DSN *dsn)
Definition: bounce.c:222
void qmgr_bounce_recipient(QMGR_MESSAGE *message, RECIPIENT *recipient, DSN *dsn)
Definition: qmgr_bounce.c:57
int flags
Definition: qmgr.h:283
#define QMGR_MSG_STATS(stats, message)
Definition: qmgr.h:341
Definition: dsn.h:17
VSTREAM * fp
Definition: qmgr.h:288
int tflags
Definition: qmgr.h:285