Question

This is below email code working file

$email = new CakeEmail('smtp');
$fromConfig = EMAIL_FROM_ADDRESS;
$fromNameConfig = EMAIL_FROM_NAME;
$email->from(array( $fromConfig => $fromNameConfig));
$email->sender(array( $fromConfig => $fromNameConfig));
$email->to($this->data['Subscribe']['email']);
$email->subject('Newsletter Confirmation');
$email->template('subscribe');
$email->emailFormat('html');

my above code taking default.ctp layout file by default(app\View\Layouts\Emails\html\default.ctp), it's fine.

But my question is i have created a other fancy.ctp layout file(app\View\Layouts\Emails\html\fancy.ctp) not use default.ctp layout file

How to use this fancy.ctp layout file in Email

Was it helpful?

Solution

I have solved issue myself......... Below my working code

$email = new CakeEmail('smtp');
$fromConfig = EMAIL_FROM_ADDRESS;
$fromNameConfig = EMAIL_FROM_NAME;
$email->from(array( $fromConfig => $fromNameConfig));
$email->sender(array( $fromConfig => $fromNameConfig));
$email->to($this->data['Subscribe']['email']);
$email->subject('Newsletter Confirmation');
$email->template('subscribe','fancy');
$email->emailFormat('html');

OTHER TIPS

Please add below line

$email->layout('fancy');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top