summaryrefslogtreecommitdiffstats
path: root/qmail-send.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmail-send.c')
-rw-r--r--qmail-send.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/qmail-send.c b/qmail-send.c
index ccdc852..685b08c 100644
--- a/qmail-send.c
+++ b/qmail-send.c
@@ -43,6 +43,7 @@
43#define OSSIFIED 129600 /* 36 hours; _must_ exceed q-q's DEATH (24 hours) */ 43#define OSSIFIED 129600 /* 36 hours; _must_ exceed q-q's DEATH (24 hours) */
44 44
45int lifetime = 604800; 45int lifetime = 604800;
46int usebounceencap = 0;
46 47
47int bouncemaxbytes = 50000; 48int bouncemaxbytes = 50000;
48 49
@@ -665,6 +666,8 @@ unsigned long id;
665 static stralloc quoted = {0}; 666 static stralloc quoted = {0};
666 datetime_sec birth; 667 datetime_sec birth;
667 unsigned long qp; 668 unsigned long qp;
669 char strid[FMT_ULONG];
670 char strqp[FMT_ULONG];
668 671
669 if (!getinfo(&sender,&birth,id)) return 0; /* XXX: print warning */ 672 if (!getinfo(&sender,&birth,id)) return 0; /* XXX: print warning */
670 673
@@ -707,8 +710,19 @@ unsigned long id;
707 while (!quote2(&quoted,bouncerecip)) nomem(); 710 while (!quote2(&quoted,bouncerecip)) nomem();
708 qmail_put(&qqt,quoted.s,quoted.len); 711 qmail_put(&qqt,quoted.s,quoted.len);
709 qmail_puts(&qqt,"\n\ 712 qmail_puts(&qqt,"\n\
710Subject: failure notice\n\ 713Subject: failure notice\n");
711\n\ 714 if(usebounceencap > 0) {
715 strid[fmt_ulong(strid,id)] = 0;
716 strqp[fmt_ulong(strqp,qp)] = 0;
717 qmail_puts(&qqt,"MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"qrfm-");
718 qmail_puts(&qqt,strid);
719 qmail_puts(&qqt,strqp);
720 qmail_puts(&qqt,"\"\n\nThis is a multi-part message in MIME format.\n\n--qrfm-");
721 qmail_puts(&qqt,strid);
722 qmail_puts(&qqt,strqp);
723 qmail_puts(&qqt,"\nContent-Type: text/plain\n");
724 }
725 qmail_puts(&qqt,"\n\
712Hi. This is the qmail-send program at "); 726Hi. This is the qmail-send program at ");
713 qmail_put(&qqt,bouncehost.s,bouncehost.len); 727 qmail_put(&qqt,bouncehost.s,bouncehost.len);
714 qmail_puts(&qqt,*sender.s ? ".\n\ 728 qmail_puts(&qqt,*sender.s ? ".\n\
@@ -733,7 +747,16 @@ I tried to deliver a bounce message to this address, but the bounce bounced!\n\
733 qmail_fail(&qqt); 747 qmail_fail(&qqt);
734 } 748 }
735 749
736 qmail_puts(&qqt,*sender.s ? "--- Below this line is a copy of the message.\n\n" : "--- Below this line is the original bounce.\n\n"); 750 if(usebounceencap > 0) {
751 qmail_puts(&qqt,*sender.s ? "--- Attached is a copy of the message.\n\n" : "--- Attached is the original bounce.\n\n");
752 qmail_puts(&qqt,"--qrfm-");
753 qmail_puts(&qqt,strid);
754 qmail_puts(&qqt,strqp);
755 qmail_puts(&qqt,"\nContent-Type: message/rfc822\nContent-Disposition: attachment\n\n");
756 } else {
757 qmail_puts(&qqt,*sender.s ? "--- Below this line is a copy of the message.\n\n" : "--- Below this line is the original bounce.\n\n");
758 }
759
737 qmail_puts(&qqt,"Return-Path: <"); 760 qmail_puts(&qqt,"Return-Path: <");
738 while (!quote2(&quoted,sender.s)) nomem(); 761 while (!quote2(&quoted,sender.s)) nomem();
739 qmail_put(&qqt,quoted.s,quoted.len); 762 qmail_put(&qqt,quoted.s,quoted.len);
@@ -760,6 +783,13 @@ I tried to deliver a bounce message to this address, but the bounce bounced!\n\
760 qmail_fail(&qqt); 783 qmail_fail(&qqt);
761 } 784 }
762 785
786 if(usebounceencap > 0) {
787 qmail_puts(&qqt,"\n--qrfm-");
788 qmail_puts(&qqt,strid);
789 qmail_puts(&qqt,strqp);
790 qmail_puts(&qqt,"--\n");
791 }
792
763 qmail_from(&qqt,bouncesender); 793 qmail_from(&qqt,bouncesender);
764 qmail_to(&qqt,bouncerecip); 794 qmail_to(&qqt,bouncerecip);
765 if (*qmail_close(&qqt)) 795 if (*qmail_close(&qqt))
@@ -1451,6 +1481,7 @@ fd_set *rfds;
1451int getcontrols() { if (control_init() == -1) return 0; 1481int getcontrols() { if (control_init() == -1) return 0;
1452 if (control_readint(&bouncemaxbytes,"control/bouncemaxbytes") == -1) return 0; 1482 if (control_readint(&bouncemaxbytes,"control/bouncemaxbytes") == -1) return 0;
1453 if (control_readint(&lifetime,"control/queuelifetime") == -1) return 0; 1483 if (control_readint(&lifetime,"control/queuelifetime") == -1) return 0;
1484 if (control_readint(&usebounceencap,"control/usebounceencap") == -1) return 0;
1454 if (control_readint(&concurrency[0],"control/concurrencylocal") == -1) return 0; 1485 if (control_readint(&concurrency[0],"control/concurrencylocal") == -1) return 0;
1455 if (control_readint(&concurrency[1],"control/concurrencyremote") == -1) return 0; 1486 if (control_readint(&concurrency[1],"control/concurrencyremote") == -1) return 0;
1456 if (control_rldef(&envnoathost,"control/envnoathost",1,"envnoathost") != 1) return 0; 1487 if (control_rldef(&envnoathost,"control/envnoathost",1,"envnoathost") != 1) return 0;