Welcome Guest, Not a member yet? Register   Sign In
Sending emails using database and template file
#1

[eluser]Gukkie[/eluser]
Hi, i am currently confused on how to make this work.

I wanna store my email subject, body in a database, i want to use a common email template to then gather n store the values and then send out the mail, how do i go about doing this?

Right now, i have a registration page so when a user registers successfully, an email gets sent.

Also i have a email_template_view.php file in my views directory.

Here,s my code in the User Controller for now:
Code:
if($this->User_model->register_user_model() == TRUE)
    {
     $this->load->library('email');
     // Send activation email and redirect to success page
     $this->email->clear(TRUE);

     $this->email->to($email);
     $this->email->from('[email protected]', 'My Site');
     $this->email->subject('Activation Link');
     $this->email->message('&lt;html&gt;&lt;body>Activate: <a href="http://www.domain.com/user/account_activation/'.$activationkey.'">Click Here to activate account</a>&lt;/body&gt;&lt;/html>');
    
     if($this->email->send())
     {
      $this->register();
     }
    }

I would greatly appreciate if someone could guide me on how i go about achieving this Smile

Cheers!




Theme © iAndrew 2016 - Forum software by © MyBB