Load information into email message. - 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: Load information into email message. (/showthread.php?tid=48579) |
Load information into email message. - El Forum - 01-21-2012 [eluser]cdonate[/eluser] Hy guys. I need to send email messages that have some default text and some strings loaded into it, like $name and $last_name, something like this: Code: message = ' The email message is hardcoded inside my controller, but I would like to put the email message into a text file and load it from the controller. This is working OK, but the $name and $last_name don't get loaded, the message stays Code: Dear '.$name.' '.$last_name.',<br> Is there any way to do this? Load the email message from a file and have the variables chaged? My email function is this: Code: function sendEmailConf($name,$last_name,$email){ Thanks!!! Load information into email message. - El Forum - 01-21-2012 [eluser]InsiteFX[/eluser] Code: Email Templates with CodeIgniter Load information into email message. - El Forum - 01-21-2012 [eluser]Iszuddin Ismail[/eluser] I would use the view. You simply create a PHP file and store it in /view folder, just like how you would normally create one. And you can use the view and generate the output as a string instead of loading the view. Here's a brief example. Code: // prepare email data for email_body.php view Load information into email message. - El Forum - 01-21-2012 [eluser]Bhashkar Yadav[/eluser] both procedures are good! Load information into email message. - El Forum - 01-22-2012 [eluser]cdonate[/eluser] Very nice, guys! Thanks for the replies! Helped me a lot! Load information into email message. - El Forum - 01-22-2012 [eluser]cdonate[/eluser] Now I'm facing a new issue. My sendEmail function is like this: Code: function sendEmail($nome,$sobrenome,$email,$subject,$emailText){ The $nome, $sobrenome and $email are send direcly from the Database, with a simples get() and then $query->name, $query->last_name and $query->email. The email is totally OK, working very well, but, if any name or last_name have these types of characters: á, à, é, è, etc, those characters get chagend, like: Claudio Donaté is changed to Claudio Donaté. Weird thing is that the email text itseft have a few of these types of characters, and they are working fine. Only the $data that is being parsed is changing. How can I correct this? My email text is as follows: Code: <html> Thanks! Load information into email message. - El Forum - 04-03-2012 [eluser]Unknown[/eluser] try using htmlentities.. |