dsfdsf21321 2013-11-08 14:22
浏览 27
已采纳

使用codeigniter在邮件中发送php变量数据

Hello I am pretty new to codeigniter. This may seems to be the simple question. But i don't know how to resolve it.

In my application i have to send the data to the user. That data will include the php variable now how can i send those variables as message.

Here is my code

The configuration settings to email

$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("
");

The email code is

$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();

Please help me i am not getting error i'm simply getting the mail without php data

  • 写回答

2条回答 默认 最新

  • dsgni26260 2013-11-08 14:36
    关注

    Try using {} around the variable, should work.

    $message="<html><body><span>This is php data {$phpVariable}</span></body></html>";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料