Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-15653

Digital Email Signing

    XMLWordPrintable

Details

    • New Feature
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      Add an option for digital email signing. I manually coded it for our site so emails the board sends out are signed. It helps us stay out of the spam folder and it was easy to implement.

      I did it like this:
      // Send message ...
      $mail_to = ($to == '') ? 'undisclosed-recipients:;' : $to;
      $err_msg = '';
      //----added for signing ATE 2017--------------
      $fp = fopen("/var/www/ssl/ext/phpbbservices/digests/includes/msg.txt", "w"); 
      $this->msg = "".'Content-Type: text/html; charset="iso-8859-1" 
      Content-Transfer-Encoding: 8bit'. "\n\n" .  $this->msg . "\n";
      fwrite($fp, $this->msg); 
      fclose($fp);
       
      openssl_pkcs7_sign("/var/www/ssl/ext/phpbbservices/digests/includes/msg.txt", "/var/www/ssl/ext/phpbbservices/digests/includes/signed.txt", file_get_contents("/var/www/ssl/ext/phpbbservices/digests/includes/publicCert.pem"), array(file_get_contents("/var/www/ssl/ext/phpbbservices/digests/includes/privateKey.pem"), 'PASSWORD_FOR_PRIVATE_KEY'), $headers); 
      $data = file_get_contents("/var/www/ssl/ext/phpbbservices/digests/includes/signed.txt"); 
      $parts = explode("\n\n", $data, 2);
      $newHeader = explode("\n", $parts[0]);
       
      $newMessage =  $parts[1];
      //-------end od signing changes --------------------------
      if ($config['smtp_delivery'])

      { $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers); }

      else

      {   //$result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, PHP_EOL, $err_msg); $result = phpbb_mail($mail_to, $this->subject, $newMessage, $newHeader, PHP_EOL, $err_msg);   }

       
      if (!$result)

      { $this->error('EMAIL', $err_msg); return false; }

       
      return true;
      }
       
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            coolate coolate [X] (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: