Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-11988

Add debug to email feature

    XMLWordPrintable

Details

    Description

      Add "debug to email" feature in send() function in lib/ezutils/classes/ezmailtransport.php. For example:

      if ( $ini->hasVariable( 'MailSettings', 'DebugEmailToEmail' ) &&
      ( $destination = $ini->variable( 'MailSettings', 'DebugEmailToEmail' ) )
      )

      { $original = ''; foreach ( $mail->receiverElements() as $recv) $original .= $recv['email'] . ', '; foreach ( $mail->bccElements() as $recv) $original .= $recv['email'] . ', '; $original = substr($original, 0, -2); $mail->setSubject( '[DebugEmail. Original-Receipient :' . $original . '] ' . $mail->subject() ); $mail->setReceiver( $destination ); $mail->setBCCElements( array() ); }

      if ( $ini->hasVariable( 'MailSettings', 'DebugEmailLog' ) &&
      ( $path = realpath( $ini->variable( 'MailSettings', 'DebugEmailLog' ) ) )
      )
      {
      $fp = @fopen( $path, 'a' );
      if ( !$fp )

      { eZDebug::writeError( "Cannot open maillog ($path) for writing.", 'eZMailTransport::send' ); }

      else

      { fwrite( $fp, sprintf("[%s] To: %s; Subject: %s\n", date('r'), $mail->receiverEmailText(), $mail->subject() ) ); fclose( $fp ); }

      return true;
      }

      Attachments

        Activity

          People

            gl gl
            ab@ez.no ab@ez.no
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: