![]() |
How to use variables in email class? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How to use variables in email class? (/showthread.php?tid=34605) |
How to use variables in email class? - El Forum - 10-04-2010 [eluser]Unknown[/eluser] I a fairly new to codeigniter and php, and this may be an obvious question, but I need some help in using variables in the codeigniter email class. I have a simple automated email response set up in a controller using this code: $this->email->from('$my_email', '$my_name'); $this->email->to($contact_email); $this->email->subject('Automate response'); $this->email->message('Thank you for your email, we will get back to you shortly'); $this->email->send(); My question is this: How do I use variables within the text of the "message" field? For example, I would like to be able to do something like: $this->email->message('Dear $contact_name, Thank you for your email, we will get back to you shortly'); Like I said, I imagine that this is a fairly basic question, but I really appreciate any help you can give me! How to use variables in email class? - El Forum - 10-04-2010 [eluser]cmgmyr[/eluser] You can do this: Code: $this->email->message('Dear '.$contact_name.', Thank you for your email, we will get back to you shortly'); Or something like this: Code: $message = 'Dear '.$contact_name.', Thank you for your email, we will get back to you shortly'; It looks like you also have to change the first line to: Code: $this->email->from($my_email, $my_name); How to use variables in email class? - El Forum - 10-04-2010 [eluser]Unknown[/eluser] Great, thanks for your help! |