作者itoc, 信區: itoc
標題[功能] mail.c 收信回條
時間06/04/10
作者: itoc (站上人數:802) 看板: plan
標題: [功能] 收信回條
時間: 2006/04/09 Sun 03:38:14 Updated: 2006/04/10
※ 引述《eddieoboe (EDDIE)》之銘言:
> bbsmail是否能寫出像是outlook那種收信回條
: hdr.h
- #define MAIL_5 0x00000010
+ #define MAIL_DSN 0x00000010 /* Delivery Status Notification */
: global.h
#define FN_ETC_EXPIRE "etc/expire.conf"
+ #define FN_ETC_RECEIPT "etc/receipt"
: etc/receipt 新增此檔案
我已經收到這封信了
> ──────────────────────────────────── <
: bbsmail.c:mail2bbs()
int fd;
FILE *fp;
+ int notification = 0;
...
...
else if (!memcmp(buf, "Content-Transfer-Encoding: ", 27))
{
mm_getencode(buf + 27, &decode);
}
+ else if (!memcmp(buf, "Disposition-Notification-To: ", 29))
+ {
+ notification = 1;
+ }
+ else if (!memcmp(buf, "Return-Receipt-To: ", 19))
+ {
+ notification = 1;
+ }
...
...
fd = hdr_stamp(folder, 0, &hdr, buf);
hdr.xmode = MAIL_INCOME;
+ if (notification)
+ hdr.xmode |= MAIL_DSN;
> ──────────────────────────────────── <
: bmtad.c:struct Agent
int letter;
+ int notification;
: bmtad.c:mta_mailer()
mode = ap->mode;
data = ap->data + 1;
+ ap->notification = 0;
...
...
else
{
+ if (!str_ncmp(data, "Disposition-Notification-To:", 28) ||
+ !str_ncmp(data, "Return-Receipt-To:", 18))
+ ap->notification = 1;
/* skip this line */
for (;;)
{
: bmtad.c:bbs_mail()
hdr.xmode = MAIL_INCOME;
+ if (ap->notification)
+ hdr.xmode |= MAIL_DSN;
> ──────────────────────────────────── <
: mail.c:mbox_browse()
if (nmode == 0 && !(xmode & MAIL_READ))
{
+ if (xmode & MAIL_DSN &&
+ vans("對方要求讀取回條,要回嗎(Y/N)?[Y] ") != 'n')
+ {
+ char title[80];
+ sprintf(title, "讀取: %.64s", str_ttl(hdr->title));
+ bsmtp(FN_ETC_RECEIPT, title, hdr->owner, 0);
+ }
hdr->xmode = xmode | MAIL_READ;
rec_put(dir, hdr, sizeof(HDR), pos, NULL);
}
--
隨便寫寫的,沒試過 :p
--
□ 本文章由 itoc 從 itoc.Dorm11.NCTU.edu.tw 發表