CodeIgniter Forums
Email error - MessageFormatter::formatMessage(): Creating message formatter failed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Email error - MessageFormatter::formatMessage(): Creating message formatter failed (/showthread.php?tid=76465)



Email error - MessageFormatter::formatMessage(): Creating message formatter failed - hsalardi - 05-14-2020

Hello all

I use email library of Codeigniter 4, the email is sent successfully but this error appears:

Quote:MessageFormatter::formatMessage(): Creating message formatter failed
SYSTEMPATH/Language/Language.php at line 248

This is my code:


Code:
    $config['protocol'] = 'smtp';
    $config['SMTPHost'] = 'smtp.mailtrap.io';
    $config['SMTPUser'] = 'xxxxxxxxxxxxxx';
    $config['SMTPPass'] = 'xxxxxxxxxxxxxx';
    $config['SMTPPort'] = 25;
    $config['SMTPCrypto'] = 'tls';
    $config['mailType'] = 'html';
    $config['charset'] = 'utf-8';
    $config['CRLF'] = "\r\n";
    $config['newline'] = "\r\n";

    $email = \Config\Services::email();
    $email->initialize($config);

    $email->setFrom('[email protected]');
    $email->setTo('[email protected]');
    $email->setSubject('Asunto de Prueba');
    $email->setMessage('Texto de Prueba...');

    $email->send();

I attach the image of error.


I appreciate your help in advance.

Regards