You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AlexFloppy edited this page Jan 27, 2015
·
5 revisions
Description
Used for work with mail tamplates. Available management using dashboard crud.
Entity
id - entity primary key
alias - unique template alias
description -template discription
subject - mail subject
fromEmail - author email
fromName - author name
bodyHtml - template body html
bodyText - template body text
created - created timestamp
updated - last updated timestamp
Usage
/** @var \Mail\Service\Mail $mailService */$mailService = $this->getServiceLocator()->get('\Mail\Service\Mail');
/** @var \Mail\Entity\Mail $template */$template = $mailService->getTemplate('sign-up');
// generate confirm url$confirmUrl = 'http://your-host/confirm_code';
// asigned value $confirmUrl will replace $template value %confirm%$mailService->assign($template, 'confirm', $confirmUrl);
/** @var \User\Entity\User $user */$user = new \User\Entity\User();
// set user email, will be used for setTo() method$user->setEmail('user@user.com');
// compare $template and $user data and set to the \Zend\Mail\Message()$message = $mailService->prepareMessage($template, $user);
// send message using \Zend\Mail\Transport\Sendmail()$mailService->send($message);