我正在使用codeigniter2.2。我有一个表格,允许用户发送他们的朋友的邀请。我的问题是它没有正确发送邮件。我的代码如下。
这是我的控制器
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Test extends CI_Controller {
public function send_mail(){
$to_email = $this->input->post('email');
$this->load->library('email');
$this->email->from('example@email.com', 'Test Team');
$this->email->to($to_email);
$pin = rand(1000,12000);
$this->email->subject('Email Test');
$this->email->message('one of your friend invited you to Test Join. If you want to be a part of This please click the below activation link.{unwrap}http://www.test.com/Test/testlog/{/unwrap}. your activation PIN : '.$pin.'');
$this->email->send();
redirect('homepage');
if ( ! $this->email->send());
{
redirect('someotherpage');
}
}
}
?>
我的查看文件如下所示
<form action="<?php echo base_url();?>test/send_mail" method="post">
<div class="input-group">
<input name="email" id="email" type="text" placeholder="Enter e-mail Id">
<span class="input-group-btn">
<input class="btn btn-info btn-lg" type="submit" name="submit" value="Invite"/>
</span>
</div>
</form>
我不知道这段代码有什么问题。