Welcome Guest, Not a member yet? Register   Sign In
Send emails using CI's parser and text from database
#1

[eluser]suntrop[/eluser]
I want to send an email with a defined HTML template and a message from a database. But furthermore I want to replace some variables within the message.

I tried …
Code:
$mail_data['variables'] = 'Frist Variable';
$mail_data['message'] = 'This text will be replaced by text from my DB. But it has {variables} in it';
$template = 'task_update';
$email_body = $this->CI->parser->parse('mail/' . $template, $mail_data, TRUE);
The view file …
Code:
<p><b>Mail Title</b></p>
<p>{message}</p>

Problem now is, the variables wont be replaced in the message, of course :-)

How can I fetch my message from DB and insert variables which get parsed by CI?




Theme © iAndrew 2016 - Forum software by © MyBB