From cc4c67b060ba2f451356c651f33f81a56035fc7e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 29 Nov 1998 18:52:38 +0000 Subject: Better bouncemail generation. svn path=/trunk/; revision=2233 --- sink.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'sink.c') diff --git a/sink.c b/sink.c index 3ebe0545..31609ccd 100644 --- a/sink.c +++ b/sink.c @@ -281,7 +281,7 @@ static int send_bouncemail(struct msgblk *msg, SockPrintf(sock, "From: FETCHMAIL-DAEMON@%s\r\n", fetchmailhost); SockPrintf(sock, "To: %s\n", msg->return_path); SockPrintf(sock, "MIME-Version: 1.0\r\n"); - SockPrintf(sock, "Content-Type: multipart/report report-type=text/plain boundary=\"om-mani-padme-hum\"\r\n"); + SockPrintf(sock, "Content-Type: multipart/report; report-type=text/plain; boundary=\"om-mani-padme-hum\"\r\n"); SockPrintf(sock, "Content-Transfer-Encoding: 7bit\r\n"); SockPrintf(sock, "\r\n"); @@ -290,19 +290,25 @@ static int send_bouncemail(struct msgblk *msg, SockPrintf(sock,"Content-Type: text/plain\r\n"); SockPrintf(sock, "\r\n"); SockWrite(sock, message, strlen(message)); - - /* RFC1892 part 2 -- machine-readable responses */ - SockPrintf(sock, "--om-mani-padme-hum\r\n"); - SockPrintf(sock,"Content-Type: message/delivery-status\r\n"); SockPrintf(sock, "\r\n"); - for (i = 0; i < nerrors; i++) - SockPrintf(sock, errors[i]); + + if (nerrors) + { + /* RFC1892 part 2 -- machine-readable responses */ + SockPrintf(sock, "--om-mani-padme-hum\r\n"); + SockPrintf(sock,"Content-Type: message/delivery-status\r\n"); + SockPrintf(sock, "\r\n"); + for (i = 0; i < nerrors; i++) + SockPrintf(sock, errors[i]); + SockPrintf(sock, "\r\n"); + } /* RFC1892 part 3 -- headers of undelivered message */ SockPrintf(sock, "--om-mani-padme-hum\r\n"); SockPrintf(sock, "Content-Type: text/rfc822-headers\r\n"); SockPrintf(sock, "\r\n"); SockWrite(sock, msg->headers, strlen(msg->headers)); + SockPrintf(sock, "\r\n"); SockPrintf(sock, "--om-mani-padme-hum--\r\n"); if (SMTP_eom(sock) != SM_OK || SMTP_quit(sock)) -- cgit v1.2.3