Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Codeigniter 4电子邮件凭据_Php_Codeigniter_Codeigniter 4 - Fatal编程技术网

Php 使用Codeigniter 4电子邮件凭据

Php 使用Codeigniter 4电子邮件凭据,php,codeigniter,codeigniter-4,Php,Codeigniter,Codeigniter 4,当我发送邮件时,它会发送,但会出现以下错误: ErrorException MessageFormatter::formatMessage():正在创建消息 格式化程序失败 这是电子邮件凭据 $config['SMTPHost'] = 'smtp.mailtrap.io'; $config['SMTPUser'] = '71xxxxxxxxx'; $config['SMTPPass'] = '3dxxxxxxxxx'; $config['SMTPPort'] = 2525; $config['S

当我发送邮件时,它会发送,但会出现以下错误:

ErrorException MessageFormatter::formatMessage():正在创建消息 格式化程序失败

这是电子邮件凭据

$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;
}

这意味着我不需要下面的参数$配置['mailType']='html'$配置['charset']='utf-8'$配置['newline']=“\r\n”;