Good afternoon!
I'm trying to do something "simple", I need to send a stylized email, I do not want to just send text, I need to insert html and css tags.
Before working with cakePHP I used PHPmailler
, where I could send emails with HTML
and CSS
in line.
I'm working on a project that uses the cakePHP framework. In the documentation, it seems to me that it has the possibility of sending emails with the embedded css, in the same way that I did, but all the emails sent go with the HTML tags printed as if they were simple texts.
$email = new CakeEmail('smtp');
$email->template('contato');
$email->emailFormat('html');
$email->to('****************');
$email->subject('Contato - Fale Conosco');
$email->viewVars(array('contato' => $this->request->data));
$email->send();
This is the code I'm using to send the emails and the view is:
<html>
<body>
<p><strong>Contato Recebido</strong></p>
<p>Data: <strong><?php echo date("d/m/Y"); ?></strong></p>
<p>Nome: <strong><?php echo $contato['Contato']['nome']?></strong></p>
<p>Telefone: <strong><?php echo $contato['Contato']['telefone']?></strong></p>
<p>E-mail: <strong><?php echo $contato['Contato']['email']?></strong></p>
<p>Assunto: <strong><?php echo $contato['Contato']['assunto']?></strong></p>
<p>Mensagem: <strong><?php echo $contato['Contato']['mensagem']?></strong></p>
</body>
However, when I leave the parameter "$ email-> emailFormat ('html'); the messages sent arrive in white, when I remove this parameter leaving the default (text) the messages arrive with the html on the screen as if it were plain text and if I put the parameter as "both" nothing arrives.