Juan
Juan

Reputation: 439

How to return the email template with data as raw html in cakephp3.6?

Hi guys i have a code here for sending an email using template and i want to return the template as raw html. How can i achieve that?

$email = new Email();
    $email
        ->template('changelogrequest')
        ->emailFormat('html')
        ->subject($subject)
        ->to($to)
        ->from($this->from)
        ->viewVars($data);

    // get raw html here

    // Log::debug($email->getLayout());
    $email->send();

Upvotes: 0

Views: 122

Answers (1)

Juan
Juan

Reputation: 439

The send() method returns an array of the email informations including the raw html. Thanks to Greg Schmidt.

 $html = email->send();
 Log::debug($html)

Upvotes: 1

Related Questions