Note that there are some explanatory texts on larger screens.

plurals
  1. PORender mail in html page
    text
    copied!<p>Im trying to render emails on my site. The problem is that these emails contains html and css, which means that I suddenly can get a green background on the page. its not rendering the mail properly. Sometimes I see html tags and so on.( se picture in the link below)</p> <p><a href="http://nullpointer.se/pic.png" rel="nofollow">http://nullpointer.se/pic.png</a></p> <p>I hade my thoughts on iframe. But as you can see i dont have a link refere to in the iframe src parameter.</p> <p>This is parts the code that im using (MVC)</p> <p>This is the Model function that im using </p> <pre><code>function get_mail_num($email_number) { $connection = imap_open($this-&gt;server, $this-&gt;user, $this-&gt;password); $mail['overview'] = imap_fetch_overview($connection,$email_number,0); $mail['message'] = imap_fetchbody($connection,$email_number,2); imap_close($connection); return $mail; } </code></pre> <p>This is the controller function that are featching the mails and sending them to the view</p> <pre><code>function index() // the inbox { $this-&gt;load-&gt;model('mail_model'); $this-&gt;load-&gt;library('pagination'); $this-&gt;load-&gt;library('table'); // config for table $config['total_rows'] = $this-&gt;mail_model-&gt;get_size(); $config['per_page'] = 10; $config['full_tag_open'] = '&lt;div id="pagination"&gt;'; $config['full_tag_close'] = '&lt;/div&gt;'; $config['base_url'] = 'http://nullpointer.se/mailendar/mail/index'; $config['num_links'] = 4; if(!$this-&gt;uri-&gt;segment(3)){$offset = 1;}else{$offset = $this-&gt;uri-&gt;segment(3);} $records = $this-&gt;mail_model-&gt;get_mail_header($config['per_page'],$offset); $data['output'] =""; $id = $offset; for($i = 0; $i &lt; count($records);$i++) { if(empty($records[$i]-&gt;subject)) { $records[$i]-&gt;subject = "No Subject"; } $data['output'].= '&lt;div onclick="funct('.$id.')" class="toggler '.($records[$i]-&gt;seen ? 'read' : 'unread').'"&gt;'; $data['output'].= '&lt;span class="subject"&gt;'.$records[$i]-&gt;subject.'&lt;/span&gt; '; $data['output'].= '&lt;span class="from"&gt;'.$records[$i]-&gt;from.'&lt;/span&gt;'; $data['output'].= '&lt;span class="date"&gt;on '.$records[$i]-&gt;date.'&lt;/span&gt;'; $data['output'].= '&lt;/div&gt;'; $data['output'].= "&lt;div class='body' id ='{$id}'&gt; &lt;/div&gt;"; $id++; } $this-&gt;pagination-&gt;initialize($config); $data['page'] = "pages/mail"; $this-&gt;load-&gt;view('includes/template',$data); } </code></pre> <p>This is the view that shows everything</p> <pre><code> &lt;div id="main" class="span-19 last colborder"&gt; &lt;h2&gt;Mail&lt;/h2&gt; &lt;?php echo $output//$this-&gt;table-&gt;generate(); ?&gt; &lt;?php echo $this-&gt;pagination-&gt;create_links(); ?&gt; &lt;/div&gt; &lt;div id = "sidebar" class = "span-4 last"&gt; &lt;h2&gt;Options&lt;/h2&gt; &lt;a href = "Convert" class ="button"&gt;Convert&lt;/a&gt; &lt;a href = "Remove" class ="button"&gt;Remove&lt;/a&gt; &lt;a href = "Move" class ="button"&gt;Move&lt;/a&gt; &lt;/div&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload