Before Send Mail
public function onBeforeSendMailEmployeeRegistration(string &$subject, string &$content, array $employee) : bool
Fires before sending a notification e-mail during the employee registration process.
Description
Trigger hook to allow external plugins to manipulate the e-mail subject and text sent to the administrator(s) after a successful employee registration.
It is possible to use this hook to do other kind of stuff after the employee registration, since this is the last triggered hook.
Parameters
- &$subject
-
(string) The e-mail subject.
- &$content
-
(string) The e-mail (HTML) content.
- $employee
-
(array) An array containing the details filled by the employee, such as
firstname
,lastname
andemail
.
Return Value
None.
Example
The example below explains how to take advantage of this filter to send a notification e-mail also to the employee that has just registered an account.
/**
* Trigger hook to allow external plugins to manipulate the e-mail subject and text
* sent to the administrator(s) after a successful employee registration.
*
* @param string &$subject The e-mail subject.
* @param string &$content The e-mail (HTML) content.
* @param array $employee An array containing the details filled by the employee.
*
* @return boolean False to prevent the e-mail sending.
*/
public function onBeforeSendMailEmployeeRegistration(&$subject, &$content, $employee)
{
// send a notification e-mail also to the employee
VAPApplication::getInstance()->sendMail(
// the sender e-mail address
VikAppointments::getSenderMail(),
// the sender name
VAPFactory::getConfig()->get('agencyname'),
// the recipient e-mail address
$employee['email'],
// the reply-to e-mail address
VikAppointments::getSenderMail(),
// the e-mail subject
'Subject goes here...',
// the e-mail body
'<p>Mail body goes here...</p>',
// the attachments to include (none in this case)
$attachments = null,
// true in case the body contains HTML tags, false in case of plain text
$is_html = true
);
return true;
}
Changelog
Version | Description |
---|---|
1.7 | Introduced. |
Last Update: 2021-10-08 09:22
Helpful?