Please help me to finish my email gateway using codeigniter
I have a problem, i want to receive an email from sender(any person) to my email and if I send with that code, the email is sent from me
But i want the email should be sent from person to my email
Controller
public function prosespengiriman()
{
$this->load->helper(array('form', 'url'));
$this->load->library('email');
//konfigurasi email
$config = array();
$config['charset'] = 'utf-8';
$config['useragent'] = 'Codeigniter';
$config['protocol']= "smtp";
$config['mailtype']= "html";
$config['smtp_host']= "ssl://smtp.gmail.com";
$config['smtp_port']= "465";
$config['smtp_timeout']= "5";
$config['smtp_user']= "myemail@gmail.com";
$config['smtp_pass']= "mypass";
$config['crlf']="\r\n";
$config['newline']="\r\n";
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from($this->input->post('from'));
$this->email->to('myemail@mail.com');
$this->email->subject($this->input->post('subject'));
$this->email->message($this->input->post('isi'));
if($this->email->send()){
echo "tutorial pengiriman email berhasil";
}else{
echo "tutorial pengiriman email gagal";
}
}
There is a view->content_contact.php
<table>
<?php echo form_open_multipart('email/prosespengiriman'); ?>
<tbody>
<tr>
<td>Dari</td>
<td><input type="email" name="from"></td>
</tr>
<tr>
<td>Subject / judul</td>
<td><input type="text" name="subject"></td>
</tr>
<tr>
<td>Isi Pesan</td>
<td><textarea name="isi"></textarea></td>
</tr>
<td></td>
<td><input type="submit" value="Kirim"></td>
</tr>
</tbody>
<?php echo form_close();?>
</table></body>
And there is the Controller : Email.php
Aucun commentaire:
Enregistrer un commentaire