Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-23694

plain text emails timeout (resulting in 3 sent mails)

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Software failure
    • Icon: Trivial Trivial
    • None
    • 6.4.8
    • Server (S)
    • None

      Steps to reproduce:

      1. No changes in environment
      2. Send a test mail through the server (localhost:25, plain email)
      3. Server logs will show `failed to send email: error receiving answer on . request: [4] Interrupted system call`

      Result:

      The test email goes through just fine, but the interface shows an error.

      For normal problem triggers, they are sent 3 times. I'm guessing because of a retry-mechanism built into the server. And then they still show as failed.
      Even though I got 3 mails.

      Expected:

      No errors on sending.

       

      Attached:

      tcpdump from the server where I did the test via the interface (tcp.stream eq 0):

      As you can see in packet 18, the "\r\n.\r\n" is sent. But then nothing.

       

      When I run a simple php script mimicking the zabbix flow observed, I get the result in "tcp.stream eq 3":

      <?php
      // SMTP server settings
      $smtpServer = "mail.salvania.be";
      $smtpPort = 25;
      
      // Sender and recipient details
      $from = "[email protected]";
      $to = "[email protected]";
      
      // Email content
      $message = "From: \"Zabbix\" <[email protected]>\r\n".
      "To: <[email protected]>\r\n".
      "In-Reply-To: <0.e6aaeb1c51ec501da39a0f92f4e6e84e.1.72717f1bd11d285a2415c519590d68d2@zabbix.com>\r\n".
      "Date: Fri, 10 Nov 2023 09:23:23 +0100\r\n".
      "Subject: Test subject\r\n".
      "MIME-Version: 1.0\r\n".
      "Content-Type: text/plain; charset=\"UTF-8\"\r\n".
      "Content-Transfer-Encoding: base64\r\n".
      "\r\n".
      'VGhpcyBpcyB0aGUgdGVzdCBtZXNzYWdlIGZyb20gWmFiYml4';
      
      // Function to send command and receive response
      function sendCommand($smtpConnection, $command, $fetch = true) {
          foreach( explode("\n", rtrim($command)) as $line ) {
              $line = rtrim($line);
              echo "> {$line}\n";
          }
      
          fputs($smtpConnection, $command);
          if ($fetch)
              echo "< " . fgets($smtpConnection);
      }
      
      // Open a TCP connection to the SMTP server
      $smtpConnection = fsockopen($smtpServer, $smtpPort, $errno, $errstr, 10);
      
      // Check if the connection is successful
      if (!$smtpConnection) {
          die("Failed to connect to the SMTP server: $errstr ($errno)");
      }
      
      // Read the welcome message from the SMTP server
      echo "< " . fgets($smtpConnection);
      
      // Send the EHLO command and handle multi-line response
      sendCommand($smtpConnection, "HELO salvania.be\r\n");
      
      // Send the MAIL FROM command
      sendCommand($smtpConnection, "MAIL FROM: <$from>\r\n");
      
      // Send the RCPT TO command
      sendCommand($smtpConnection, "RCPT TO: <$to>\r\n");
      
      // Send the DATA command
      sendCommand($smtpConnection, "DATA\r\n");
      
      // Send the email headers and body
      sendCommand($smtpConnection, $message, false);
      sendCommand($smtpConnection, "\r\n.\r\n");
      
      // Send the QUIT command
      sendCommand($smtpConnection, "QUIT\r\n");
      
      // Close the connection
      fclose($smtpConnection);
      ?>
      
      

       

            mbuz Maksym Buz
            svaningelgem Steven Van Ingelgem
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: