I am sending an email using the following code. But it shows up in my email as from "me@gmail.com" also when I press reply on the email it wants to send it to "me@gmail.com" Don't know if I've done something wrong or?
$this->email->from($this->input->post('email'), $this->input->post('thename'));
$this->email->reply_to($this->input->post('email'), $this->input->post('thename'));
$this->email->to('me@gmail.com');
$this->email->subject('New Feedback');
$this->email->message($this->input->post('message'));
$this->email->send();
I set up a simple email test in CodeIgniter v 2.1.2 as follows:
$this->email->from('malcom@awdoffice.com','Malcom');
$this->email->reply_to('awd@awdoffice.com','AWD');
$this->email->to('marc@awdoffice.com');
$this->email->subject('Subject Mailer-Test');
$this->email->message('Lorem est email.');
$this->email->send();
$rc_email = $this->email->print_debugger();
I suggest that you go through the following debugging procedure.
(1) Hard code all email addresses and names in the from and reply_to setters. Test to see if the problem still exist.
(2) If step (1) fixes the problem, then something may be wrong with your input variables so try printing out the variables (append to email body text).
(3) Print out the text returned from print_debugger
(4) I tested the email in Mozilla Thunderbird and the from, reply_to and to fields worked as expected. What email client are you using? what email server (if testing locally)?
Please keep us posted with your progress.
I figured it out. I had uploaded the site to my "real" server and forgot to change the baseurl of the site.. I still had it as localhost. So whenever I sent an email it was using my localhost and the from email I had setup in phpmailer.
I know quite a silly mistake, but being up for 20+ hours can do that to someone.
Thanks for all the help.