Hello,
I observed some problem with busybox sendmail applet in case when
present many recipient in headers in one line like below:
To: [email protected],[email protected]
I think it is valid syntax and PHP mail function use it. When I try add
many recipients by PHP mail function using busybox sendmail I get error
like this:
# echo -e "To: [email protected],[email protected]\n\nTEST" | ./sendmail
-f [email protected] -S 127.0.0.1:25 -au"user" -ap"pass" -t -v
...
sendmail: send:'RCPT TO:<[email protected][email protected]>'
sendmail: recv:'550 5.1.1 <[email protected][email protected]>: Recipient
address rejected: User unknown'
sendmail: Bad recipient: <[email protected][email protected]>
sendmail: send:'DATA'
sendmail: recv:'554 5.5.1 Error: no valid recipients'
sendmail: send:'QUIT'
sendmail: recv:'221 2.0.0 Bye'
It's becouse busybox while reading recipients from headers doesn't split
them by comma.
I made a small patch for this, it works but I'm not c coder and I don't
know is it correct and without bugs. Propably it has some bugs becouse I
do not understand function sane_address. I know what this function
doing, but don't know how.
--- busybox-1.21.1/mailutils/sendmail.c.org 2013-06-29
16:58:06.000000000 +0200
+++ busybox-1.21.1/mailutils/sendmail.c 2013-12-29 22:23:21.304659253 +0100
@@ -111,6 +111,17 @@
bb_error_msg("Bad recipient: <%s>", s);
}
+static void rcptto_list(const char *s)
+{
+ char *buff = strdup(s);
+ char *tmp = strtok(buff, ",");
+ while(tmp != NULL) {
+ rcptto(sane_address(tmp));
+ tmp = strtok(NULL, ",");
+ }
+ free(buff);
+}
+
int sendmail_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sendmail_main(int argc UNUSED_PARAM, char **argv)
{
@@ -284,12 +295,12 @@
// To: or Cc: headers add recipients
if (opts & OPT_t) {
if (0 == strncasecmp("To:", s, 3) || 0 ==
strncasecmp("Bcc:" + 1, s, 3)) {
- rcptto(sane_address(s+3));
+ rcptto_list(s+3);
goto addheader;
}
// Bcc: header adds blind copy (hidden) recipient
if (0 == strncasecmp("Bcc:", s, 4)) {
- rcptto(sane_address(s+4));
+ rcptto_list(s+4);
free(s);
continue; // N.B. Bcc: vanishes from
headers!
}
If someone find time to made this fix I will be gratefull. By now I will
use my patch and pray. Thanks and sorry my English.
--
Pozdrawiam! / Best regards!
------------------
Piotr Rotter
Konsultant IT / IT Consultant
===========================================
http://www.ACTIVE24.pl - Powerful hosting - surprisingly easy
===========================================
ul. BarkociĆska 6, 03-543 Warszawa PL
Email: [email protected]
Tel: +48 22 423 33 22
GSM: +48 503 10 40 50
Skype: active24pl
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox