【问题标题】:How to use mail function in codeIgniter? [duplicate]如何在codeIgniter中使用邮件功能? [复制]
【发布时间】:2019-03-22 04:33:32
【问题描述】:
   $query = $this->db->insert('table_name',$data);
   if($query==true)
   {
      $to = $this->input->post('email');
      $subject = "Activation Link";
      $message = "<p>Welcome: ".$this->input->post('email')."</p>
                    <p>Thank you for join InSquareFeet. To activate your account please <a href=".base_url()."thankyou/".$confirm_id."></a></p>";
      $headers = "MIME-Version: 1.0" . "\r\n";
      $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
      $headers .= "From: ayush@gmail.com";
      mail($to,$subject,$message,$headers);
      echo '<p>Thank you for connecting with us. We have sent you an activation link on your email id.</p>';
   }
   else
   {
      echo '<p>Error!</p>';
   }

在这段代码中,我创建了一个邮件函数,我将表单值插入到数据库中,该函数运行良好,但我还想将确认邮件发送给无法正常工作的候选人。我不知道为什么?我在哪里做错了?请帮帮我。

谢谢

【问题讨论】:

  • @MasivuyeCokile 我哪里做错了?
  • 对照你的代码检查 dup
  • 您正在使用 codeigniter。您应该使用他们的邮件实用程序库。
  • 如何它不起作用?你有错误吗?如果是这样,你会得到什么错误?你收到邮件了吗?
  • 希望对您有所帮助:stackoverflow.com/questions/46780288/…

标签: php codeigniter email


【解决方案1】:

Codeigniter 提供了一些带有示例的内置库。我想你们甚至没有搜索任何东西,只是问问题如何使用。即使您在 google 中搜索 如何在 Codeigniter 中使用电子邮件,您也会得到许多关于 codeigniter 库及其使用的教程。

这里有一些示例供您参考。不要使用 mail() 函数,而是使用允许您设置 smtp 配置的内置库。

How to use email function in codeigniter

How to set configuration for email in codeingiter

Sending email with google smtp configuration in codeigniter

another example about setting config in codeigniter email

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-04
    • 2016-05-27
    相关资源
    最近更新 更多