diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-12-30 08:21:01 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-12-30 08:21:01 +0000 |
commit | c8b9bd90f61b3bcd2202196fcd516af714aef9e1 (patch) | |
tree | 0eae701db549cc8b63530657257e898d551c3574 /sink.c | |
parent | 2ed457b30398704e63d4f64a8d3e650057ec3efb (diff) | |
download | fetchmail-c8b9bd90f61b3bcd2202196fcd516af714aef9e1.tar.gz fetchmail-c8b9bd90f61b3bcd2202196fcd516af714aef9e1.tar.bz2 fetchmail-c8b9bd90f61b3bcd2202196fcd516af714aef9e1.zip |
No 1894. But at least we can see why it fails...
svn path=/trunk/; revision=2296
Diffstat (limited to 'sink.c')
-rw-r--r-- | sink.c | 40 |
1 files changed, 39 insertions, 1 deletions
@@ -307,8 +307,46 @@ static int send_bouncemail(struct msgblk *msg, SockPrintf(sock, "--%s\r\n", boundary); SockPrintf(sock,"Content-Type: message/delivery-status\r\n"); SockPrintf(sock, "\r\n"); +#ifdef RFC1894 + SockPrintf(sock, "Reporting-MTA: DNS; %s\r\n", fetchmailhost); +#endif /* RFC1894 */ for (i = 0; i < nerrors; i++) + { +#ifndef RFC1894 SockPrintf(sock, "%s\r\n", errors[i]); +#else + /* Minimum RFC1894 compliance + Diagnostic-Code field */ + SockPrintf(sock, "\r\n"); + /* + * And here's the real reason RFC1984-style DSNs don't + * work; we can't generate Final-Recipient properly. + * First, fetchmailhost is probably going to be just + * `localhost'. Secondly, we're only sure of the final + * recipient in the single-drop case; in the multidrop + * case, we don't have any idea how to get that + * information (it's not guaranteed that errors even + * correspond one-to-one with recipients). + */ + SockPrintf(sock, "Final-Recipient: RFC822; %s@%s\r\n", + msg->recipients->id, + fetchmailhost); + SockPrintf(sock, "Action: failed\r\n"); + if (strlen(errors[i]) > 9 && isdigit(errors[i][4]) + && errors[i][5] == '.' && isdigit(errors[i][6]) + && errors[i][7] == '.' && isdigit(errors[i][8])) + { + /* Enhanced status code available, use it */ + SockPrintf(sock, "Status: %5.5s\r\n", &(errors[i][4])); + SockPrintf(sock, "Diagnostic-Code: smtp; %3.3s%s\r\n", errors[i], &(errors[i][9])); + } + else + { + /* Enhanced status code not available, fake one */ + SockPrintf(sock, "Status: %c.0.0\r\n", errors[i][0]); + SockPrintf(sock, "Diagnostic-Code: smtp; %s\r\n", errors[i]); + } +#endif /* RFC1894 */ + } SockPrintf(sock, "\r\n"); } @@ -363,7 +401,7 @@ static int handle_smtp_error(struct query *ctl, struct msgblk *msg) * */ send_bouncemail(msg, - "We do not accept mail from you.\r\n", + "Our spam filter rejected this transaction.\r\n", 1, responses); return(PS_REFUSED); } |