Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

Use html and css to format email with Code Igniter

$
0
0

I want to send a simple view with Codeigniter through an email so that the email looks nice to the user. How do I do this? Here is my code so far in my controller.

public function test_email()
        {
            $message = $this->load->view('application/recommendation_email', '', TRUE);
            $this->load->library('email');          
            $this->email->from('xxxxxxx@gmail.com', 'something');
            $this->email->to('xxxxxxx@gmail.com'); 
            $this->email->subject('Letter of Recommendation Request');
            $this->email->message($message);
            $this->email->send();
        }

Currently it's just sending html code to me. But I want it took like the way it is in the browser. Here's my html + css.

<html>

    <body>
        <p>Dear Joe<?php //echo $name ?>,
        </p>

        <p>SOME TEXT
        </p>

        <a href="a reference">a reference
        </a><br><br><br>

        <p>Thanks,<br><br>
            The Team
        </p>
    </body>
</html>


<style type='text/css'>

body{
    font-family: "Lucida Grande";
    background-color: #fdfdfd;
}
a {
  color: #008ee8;
  text-decoration: none;
  outline: none;
}
a:hover {
  color: #ec8526;
  text-decoration: none;
}


</style>

Viewing all articles
Browse latest Browse all 29748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>