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