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.