我目前正在开发一个代码点火器网站,它从联系人form.till发送电子邮件,这次我使用了Xampp的sendmail库,邮件发送成功。
在我的项目中发送的流邮件如下:
在单击“发送”按钮时,联系人表单>>会转到一个javascript代码,它验证输入>>,ajax调用my_email.php,这是一个正常的my_email.php代码,用于发送邮件(放置在应用程序/视图中的my_email.php,并在我的控制器上放置相应的控制器代码)。
$send = @mail($global_email, $subject, $message, $headers); // normal php code for sending mail因此,该网站现在正在使用Xampp的sendmail(sendmail.ini) libary。但是当我托管这个网站时,它不再支持sendmail了,它只支持system/library/email.php上的email类,根据我的代码点火器,这个类位于中。
目前没有任何application/cofig.文件isnide email.php。
所以我的问题是,(1)在不改变system/library/email.php的任何内容的情况下,system/library/email.php的内容是什么?(2)如何将这个system/library/email.php类加载到我的网站上。
发布于 2014-12-03 15:06:34
您可以在这里阅读代码点火器的电子邮件类:https://ellislab.com/codeigniter/user-guide/libraries/email.html
一般来说,这种用法如下所示:
//load the email class as a library
$this->load->library('email');
$this->email->from('your@example.com', 'Your Name');
$this->email->to('someone@example.com');
$this->email->cc('another@another-example.com');
$this->email->bcc('them@their-example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();您只需要适当地更改代码,在控制器/模型中使用mail()函数就可以使用电子邮件代码点火器类。如果您使用ajax发送电子邮件,您应该制作一个控制器来处理来自您的网站的ajax请求,并从您的javascript函数中指向该控制器来进行表单验证/处理。
https://stackoverflow.com/questions/27271169
复制相似问题