We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    First, make sure the plugin is executing. Look in the MODX error log for the results.

    Second (if it is executing), install and use the QuickEmail plugin to make sure the mail system is working.
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 46886
      • 1,154 Posts
      This is right?
      /* Set these variables */
      ...
      $from = '[email protected]'; // Joe Blow <[email protected]>, i.e., your email address
      
      ...
      
      $sender = 'Admin'; // Sender's email address, use the same thing as $from.


      Should be this?
      /* Set these variables */
      ...
      $from = '[email protected]'; // Joe Blow <[email protected]>, i.e., your email address
      
      ...
      
      $sender = '[email protected]'; // Sender's email address, use the same thing as $from.

      • discuss.answer
        • 46309
        • 79 Posts
        Yeah it was copy paste mistake when upload the code here trying different values but it was still nothing. The main error come from the $reply. It should be $email. Finally I decided to use only the code provided from BobRay under /*Send the message */ with valuse inside and called a chunk with $message = $modx->getChunk('fileUploadTpl'); There is no error and the email is sent:

        // Send Email
        $message = $modx->getChunk('fileUploadTpl');
        
        $modx->getService('mail', 'mail.modPHPMailer');
        $modx->mail->set(modMail::MAIL_BODY,$message); //goes to chunk
        $modx->mail->set(modMail::MAIL_FROM,'[email protected]'); // Email From:
        $modx->mail->set(modMail::MAIL_FROM_NAME,'Site Admin'); // Name From: 
        $modx->mail->set(modMail::MAIL_SUBJECT,'New FileUpload'); // Subject:
        $modx->mail->address('to','[email protected]'); // Email To:
        $modx->mail->setHTML(true);
            /* Check for errors */
            if (!$modx->mail->send()) {
                $modx->log(modX::LOG_LEVEL_ERROR,'An error occurred while trying to send the email: '.$modx->mail->mailer->ErrorInfo);
            }
                 else {
                    $modx->log(modX::LOG_LEVEL_ERROR, 'Email sent successfully: '.$modx->mail->mailer->ErrorInfo);
                }
            }
            $modx->mail->reset();
        


        Just a simple message in fileUploadTpl chunk:
        Some of the users uploaded a file.


        There was also an error from the email addresses based on:
        SMTP error from remote mail server after end of data:
        550 5.7.1 [BFD] Sender prohibited by SPF

        and that's where some of the errors in the beginning come from but you have just to play with the emails and choose the right one in order to receive the message without Mail delivery failed.
          peace&love / bike&ride
          • 46309
          • 79 Posts
          So thanks again BobRay for all your help!
            peace&love / bike&ride
            • 3749
            • 24,544 Posts
            I'm glad you got it sorted. Thanks for reporting back. smiley
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting