svn: /SVNROOT/ commit-email.php
| From: | Hannes Magnusson | Date: | Thu, 29 Jun 2017 15:54:49 +0000 |
| Subject: | svn: /SVNROOT/ commit-email.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98269@lists.php.net to get a copy of this message | ||
bjori Thu, 29 Jun 2017 15:54:49 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=342626
Log:
quickfix mailer
Changed paths:
U SVNROOT/commit-email.php
Modified: SVNROOT/commit-email.php
===================================================================
--- SVNROOT/commit-email.php 2017-06-27 05:15:25 UTC (rev 342625)
+++ SVNROOT/commit-email.php 2017-06-29 15:54:49 UTC (rev 342626)
@@ -261,22 +261,41 @@
if ($socket === FALSE) {
fail("Couldn't connect to SMTP server {$smtp_server}. Errno: {$errno}.\n");
}
+sleep(1);
$smtp_recipients = array_unique(array_merge($emails_to, $always_addresses));
-$rcpt_commands = "RCPT TO:<" . implode(">\r\nRCPT TO:<",
$smtp_recipients) . ">";
-sleep(1);
-fwrite($socket, <<<SMTP
-EHLO localhost\r
-MAIL FROM:<{$envelope_sender}> BODY=8BITMIME\r
-{$rcpt_commands}\r
-DATA\r
-{$msg_body}\r
-.\r
-QUIT\r
+$messages = array();
+$messages[] = "EHLO localhost\r\n";
+$messages[] = "MAIL FROM:<{$envelope_sender}> BODY=8BITMIME\r\n";
+foreach($smtp_recipients as $rcpt) {
+ $messages[] = "RCPT TO:<$rcpt>\r\n";
+}
-SMTP
- );
+function read($socket) {
+ do {
+ $read = array($socket);
+ $write = NULL;
+ $e = NULL;
+ if (stream_select ($read, $write, $e, 0, 100) > 0) {
+ fgets ($socket);
+ } else {
+ break;
+ }
+ } while (true);
+}
+function write($socket, $messages) {
+ foreach($messages as $msg) {
+ read ($socket);
+ fwrite ($socket, $msg);
+ }
+}
+$messages[] = "DATA\r\n";
+$messages[] = "{$msg_body}\r\n";
+$messages[] = ".\r\n";
+$messages[] = "QUIT\r\n";
+write($socket, $messages);
+
if (!$is_DEBUG) {
// For the record, I don't bother parsing errors here because the local MTA
// pretty much never errors out directly. Instead the errors come from the