Code Ignitor email - style tag/css not working

abdo5

New Member
I am trying to send innerhtml of a particular div to email(in code ignitor frame work).I got the inner html of the div using jquery and transfered the data to the controller using ajax.The mail worked.But my problem is html classes,style tags(except the inline styles i wrote in the view file html),style sheet are not working.Is there any way to add my style.css file in the email content?I will be ok even if the tag works properly,which I had put at the begining of the section.Please help.Here is my code.Ajax code for transfering html to controller: \[code\]<script type="text/javascript"> $(function() { $('#sendmail').click(function(e) { e.preventDefault(); $.ajax({ url:'<?php echo site_url();?>/welcome/send', type:'POST', data:{'message':$('#body').html(),'subject':'Subject of your e-mail'}, success:function(data) { alert('You data has been successfully e-mailed'); alert('Your server-side script said: ' + data); } }); });\[/code\]});\[code\]</script>\[/code\]Code in the controllerpublic function send() {\[code\] $nome = $this->input->post('message'); $config = array( 'protocol' => 'smtp', 'smtp_host' => 'send.one.com', 'smtp_port' => '2525', 'smtp_user' => '[email protected]', 'smtp_pass' => 'akhil123', 'charset' => 'utf-8', 'wordwrap' => TRUE, 'mailtype' => 'html' ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('[email protected]', 'The Wanderers'); $this->email->to('[email protected]'); $this->email->subject('The Wanderers Proforma Invoice '); $formatedMessag =''; $formatedMessag = '<html><head><link rel="stylesheet" type="text/css" href="http://localhost/study/extra/style.css"></head><body><style type="text/css">p{color:#cccccc;font-weight:bold;}</style>'; $formatedMessag .= $nome.'</body></html>'; $this->email->message($formatedMessag); if ($this->email->send()) { echo $formatedMessag; }}\[/code\]
 
Back
Top