[eluser]Elias Rufino[/eluser]
Hello again guys. It's solved.
I will not post the form code, but if someone needs it, just tell me.
I have some validation to this form, the controller do that. So, I have things like that:
Code:
public function index()
{
$output[] = NULL;
// (...) - There are some things here, like captcha...
if ($this->form_validation->run() === FALSE)
{
$output['content'] = $this->load->view('contact', $data, TRUE);
}
else
{
$mail['ip'] = $this->input->server("REMOTE_ADDR");
$mail['date'] = date('d/m/Y H:i:s');
$mail['subject'] = $this->input->post('subject', TRUE);
$mail['name'] = $this->input->post('name');
$mail['email'] = $this->input->post('email');
$mail['phone'] = $this->input->post('phone');
$mail['msg'] = $this->input->post('msg', TRUE);
$this->load->library('email');
$this->email->from('some@email', 'Name from sender');
$this->email->to('who_receive@email');
$this->email->subject($mail['subject']);
$this->email->message("IP: ".$mail['ip'].
"\nDate: ".$mail['date'].
"\nName: ".$mail['name'].
"\nE-Mail: ".$mail['email'].
"\nPhone: ".$mail['phone'].
"\nSubject: ".$mail['subject'].
"\n\nMessage: \n".$mail['msg']);
$this->email->send(); // Here the first e-mail is sent
$msg1 = 'Hello ';
$msg2 = '. Great to receive your contact. We will call you as soon as possible.';
$this->email->from('who_sends@email', 'Your Contact');
$this->email->to($mail['email']); // will send the new mail to the address person filled in the form
$this->email->subject($mail['subject']); // or can use another subject, just to test
$this->email->message("Data: ".$mail['data'].
"\n".$msg1.
"".$mail['name'].
"".$msg2.
"\n".
"\nNice to talk to you - www.yoursite.com");
$this->email->send();
$this->session->set_flashdata('success', 'Success. Your contact was sent.');
redirect(site_url('contact'), 'location');
}
$this->load->view('layouts/default', $output);
}
So, CroNiX give me the tip and it really works. I can just run and send it in a normal way, after the first e-mail is sent.
It's just a test, the message to the second e-mail should be better organized.
Thank you very much.
Hugs,
Elias