6.9.3 qmgr_active_done_2_generic函数:发送邮件状态通知信
2016-04-07 15:39
393 查看
/qmgr/qmgr_active.c 340 /* qmgr_active_done_2_generic -continue processing */ 341 342 static voidqmgr_active_done_2_generic(QMGR_MESSAGE *message) 343 { 344 const char *path; 345 struct stat st; 346 347 /* 348 * A delivery agent marks a queue file as corrupt by changing its 349 * attributes, and by pretending that delivery was deferred. 350 */ 351 if (message->flags 352 && mail_open_ok(MAIL_QUEUE_ACTIVE, message->queue_id,&st, &path) == MAIL_OPEN_NO) { 353 qmgr_active_corrupt(message->queue_id); 354 qmgr_message_free(message); 355 return; 356 }
351-356尝试打开active队列中的邮件文件,失败则将其移入corrupt队列。
357 358 /* 359 * If we did not read all recipients from this file, go read some more, 360 * but remember whether some recipients have to be tried again. 361 * 362 * Throwing away queue files seems bad, especially when they made it this 363 * far into the mail system. Therefore we save bad files to a separate 364 * directory for further inspection by a human being. 365 */ 366 if (message->rcpt_offset > 0) { 367 if (qmgr_message_realloc(message) == 0) { 368 qmgr_active_corrupt(message->queue_id); 369 qmgr_message_free(message); 370 } else { 371 if (message->refcount == 0) 372 qmgr_active_done(message); /*recurse for consistency */ 373 } 374 return; 375 }
366-375 QMGR_MESSAGE->rcpt_offset字段表示收件人地址偏移,当读取完所有收件人地址信息后该参数值应为0。如果其大于0,表明有未读取的收件人信息。因为收件人信息可能会提供新的所要求的MDA和域信息等信息,而且如果有未发送的收件人,就不能销毁邮件文件而依然要尝试发送邮件,所以这里如果收件人地址没有读取完毕的话要继续进行读取。
376 377 /* 378 * XXX With multi-recipient mail, some recipients may have NOTIFY=SUCCESS 379 * and others not. Depending on what subset of recipients are delivered, 380 * a trace file may or may not be created. Even when the last partial 381 * delivery attempt had no NOTIFY=SUCCESS recipients, a trace file may 382 * still exist from a previous partial delivery attempt. So as long as 383 * any recipient has NOTIFY=SUCCESS we haveto always look for the trace 384 * file and be prepared for the file not to exist. 385 * 386 * See also comments in bounce/bounce_notify_util.c. 387 */ 388 if ((message->tflags & (DEL_REQ_FLAG_USR_VRFY |DEL_REQ_FLAG_RECORD 389 |DEL_REQ_FLAG_REC_DLY_SENT)) 390 || (message->rflags & QMGR_READ_FLAG_NOTIFY_SUCCESS)) { 391 atrace_flush(message->tflags, //参数 401 return; 402 } 403 404 /* 405 * Asynchronous processing does not reach this point. 406 */ 407 qmgr_active_done_25_generic(message); 408 }
388-402 在以下情况下为客户发送邮件状态通知信:
状态DEL_REQ_FLAG_REC_DLY_SENT表示设置了postfix参数confirm_delay_cleared,表示通知用户告警延迟何时清除。
状态DEL_REQ_FLAG_USR_VRFY表示运行了sendmail –bv命令,该命令可验证收件人地址,并返回响应消息。
状态DEL_REQ_FLAG_RECORD表示运行了sendmail –v –bm命令,
状态QMGR_READ_FLAG_NOTIFY_SUCCESS表示客户端传入了DSN参数notify=SUCCESS
对以上情况均调用atrace_flush函数发送邮件状态通知信,该函数使用BOUNCE_CMD_TRACE命令调用bounce模块的服务bounce_trace_service。
相关文章推荐
- [LeetCode]题解(python):138-Copy List with Random Pointer
- shader param
- 太原网络营销师如何分析及考核百度竞价(SEM)人员
- 闭包
- java使用数组实现顺序队列
- 数据库面试题
- lua使用table.concat连接大量字符串
- Spring MVC 入门示例讲解
- vs 2010 快捷键
- 改变UITextView的边框颜色
- 自定义Dialog样式+大小+位置
- Android BLE开发之Android手机搜索iBeacon基站
- 寻找峰值
- (1,eval)('this')释义
- Redis 并发加锁
- SVN中trunk,branches,tags用法详解
- 为View添加阴影效果的工具类:ShadowViewHelper
- Spring3MVC 在JSP中使用@ModelAttribute--源自技术
- 七年阿里老人谈新人成长(转载)
- HDU 1096 A+B for Input-Output Practice (VIII)