你好我对codeigniter很新。这似乎是一个简单的问题。但我不知道如何解决它。
在我的应用程序中,我必须将数据发送给用户。那个数据现在将包含php变量如何将这些变量作为消息发送。
这是我的代码
电子邮件的配置设置
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'user@gmail.com',
'smtp_pass' => '******',
'smtp_timeout' => '4',
'mailtype' => 'html',
'charset' => 'iso-8859-1'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
电子邮件地址是
$phpVariable="some data";
$message="<html><body><span>This is php data $phpVariable</span></body></html>";
$this->email->from('review@findacarehome.com','Review for Find a care home');
$this->email->to('anotheruser@gmail.com');
$this->email->Subject('Subject');
$this->email->message($message);
$this->email->send();
请帮助我,我没有收到错误,我只是在没有php数据的情况下收到邮件
答案 0 :(得分:1)
尝试:
$message="<html><body><span>This is php data " . $phpVariable . "</span></body></html>";
答案 1 :(得分:1)
尝试在变量周围使用{},应该可以。
$message="<html><body><span>This is php data {$phpVariable}</span></body></html>";