From d32771d1135542b16137c90ec9382294bb98c0ed Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Tue, 16 Aug 2005 12:45:24 +0000 Subject: Write RFC-compliant BSMTP envelopes. Reported by Nico Golde. svn path=/trunk/; revision=4237 --- sink.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sink.c') diff --git a/sink.c b/sink.c index a3c52a5b..5483ca04 100644 --- a/sink.c +++ b/sink.c @@ -713,6 +713,7 @@ static int open_bsmtp_sink(struct query *ctl, struct msgblk *msg, /* open a BSMTP stream */ { struct idlist *idp; + int need_anglebrs; if (strcmp(ctl->bsmtp, "-") == 0) sinkfp = stdout; @@ -720,8 +721,12 @@ static int open_bsmtp_sink(struct query *ctl, struct msgblk *msg, sinkfp = fopen(ctl->bsmtp, "a"); /* see the ap computation under the SMTP branch */ - fprintf(sinkfp, - "MAIL FROM:%s", (msg->return_path[0]) ? msg->return_path : user); + need_anglebrs = (msg->return_path[0] != '<'); + fprintf(sinkfp, + "MAIL FROM:%s%s%s", + need_anglebrs ? "<" : "", + (msg->return_path[0]) ? msg->return_path : user, + need_anglebrs ? ">" : ""); if (ctl->pass8bits || (ctl->mimemsg & MSG_IS_8BIT)) fputs(" BODY=8BITMIME", sinkfp); @@ -746,7 +751,7 @@ static int open_bsmtp_sink(struct query *ctl, struct msgblk *msg, for (idp = msg->recipients; idp; idp = idp->next) if (idp->val.status.mark == XMIT_ACCEPT) { - fprintf(sinkfp, "RCPT TO: %s\r\n", + fprintf(sinkfp, "RCPT TO:<%s>\r\n", rcpt_address (ctl, idp->id, 1)); (*good_addresses)++; } -- cgit v1.2.3