使用 Codeigniter 4 电子邮件凭据
Using Codeigniter 4 Email Credentials
当我发送邮件时,它会发送,但是会出现以下错误:
ErrorException MessageFormatter::formatMessage(): Creating message
formatter failed
这是电子邮件凭据
$config['SMTPHost'] = 'smtp.mailtrap.io';
$config['SMTPUser'] = '71xxxxxxxxx';
$config['SMTPPass'] = '3dxxxxxxxxx';
$config['SMTPPort'] = 2525;
$config['SMTPCrypto'] = 'tls';
$config['mailType'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
用您的整个电子邮件配置代码替换它
//* Initialize email class
$config['SMTPHost'] = 'smtp.mailtrap.io';
$config['SMTPUser'] = 'xxxxxxxxxxx';
$config['SMTPPass'] = 'xxxxxxxxxxx';
$config['SMTPPort'] = 2525;
$config['SMTPCrypto'] = 'tls';
//* Prepare the emai destination
$email = \Config\Services::email();
$email->initialize($config);
$email->setFrom(user@domain.com, sender name);
$email->setTo(you@mail.com);
$email->setSubject('Test email');
$email->setMessage('Testing');
if($email->send())
{
return TRUE;
}
else
{
return FALSE;
}
当我发送邮件时,它会发送,但是会出现以下错误:
ErrorException MessageFormatter::formatMessage(): Creating message formatter failed
这是电子邮件凭据
$config['SMTPHost'] = 'smtp.mailtrap.io';
$config['SMTPUser'] = '71xxxxxxxxx';
$config['SMTPPass'] = '3dxxxxxxxxx';
$config['SMTPPort'] = 2525;
$config['SMTPCrypto'] = 'tls';
$config['mailType'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
用您的整个电子邮件配置代码替换它
//* Initialize email class
$config['SMTPHost'] = 'smtp.mailtrap.io';
$config['SMTPUser'] = 'xxxxxxxxxxx';
$config['SMTPPass'] = 'xxxxxxxxxxx';
$config['SMTPPort'] = 2525;
$config['SMTPCrypto'] = 'tls';
//* Prepare the emai destination
$email = \Config\Services::email();
$email->initialize($config);
$email->setFrom(user@domain.com, sender name);
$email->setTo(you@mail.com);
$email->setSubject('Test email');
$email->setMessage('Testing');
if($email->send())
{
return TRUE;
}
else
{
return FALSE;
}