static void print_recipient_status (smtp_recipient_t recipient, const char *mailbox, void *arg) { const smtp_status_t *status; status = smtp_recipient_status (recipient); printf ("%s: %d %s", mailbox, status->code, status->text); }
/* Callback to print the recipient status */ static void print_recipient_status (smtp_recipient_t recipient, const char *mailbox, void *arg) { const smtp_status_t *status; status = smtp_recipient_status (recipient); if (status->text[strlen(status->text) - 2] == '\r') status->text[strlen(status->text) - 2] = 0; INFO ("notify_email: notify sent to %s: %d %s", mailbox, status->code, status->text); } /* void print_recipient_status */
return false; } /* Report on the success or otherwise of the mail transfer. */ status_ = smtp_message_transfer_status(message_); BOOSTER_LOG(debug,__FUNCTION__) << status_->code << ((status_->text != NULL) ? status_->text : "\n") << std::endl; smtp_enumerate_recipients (message_, print_recipient_status, NULL); return true; } /* Callback to prnt the recipient status */ void print_recipient_status(smtp_recipient_t recipient, const char *mailbox, void *arg arg_unused) { const smtp_status_t *status; status = smtp_recipient_status(recipient); BOOSTER_LOG(debug,__FUNCTION__) << mailbox << ": " << status->code << " " << status->text; } /* Callback function to read the message from a file. Since libESMTP does not provide callbacks which translate line endings, one must be provided by the application. The message is read a line at a time and the newlines converted to \r\n. Unfortunately, RFC 822 states that bare \n and \r are acceptable in messages and that individually they do not constitute a line termination. This requirement cannot be reconciled with storing messages with Unix line terminations. RFC 2822 rescues this situation slightly by prohibiting lone \r and \n in messages. The following code cannot therefore work correctly in all situations.