listing_inquiry_email_payload
Filter inquiry email payload before email is sent.
You need to have a working knowledge of Hooks before you get started.
Parameters
Name | Type | Description |
---|---|---|
$payload |
parameter |
(array) associative array with email parts: to, bcc, fromEmail, fromName, subject, body |
$params |
parameter |
(array) associative array with contextual data |
Boilerplate Code
Use the boilerplate code to start using the filter, and add your own logic to modify the first argument and return it.
Clickfwd\Hook\Filter::add('listing_inquiry_email_payload', function($payload, $params)
{
// Uncomment line below to view available data passed into hook
// fwd_dd($payload, $params);
return $payload;
});
Examples
Modify Sender Name and Email
When an inquiry is sent, the email sender name and email are populated with the information provided by the user in the inquiry form. With the code below you can change the sender email and name so recipients of inquiries cannot reply directly to the sender.
Clickfwd\Hook\Filter::add('listing_inquiry_email_payload', function($payload, $params)
{
$listing = $params['listing'];
$event = $params['event'];
$extraFields = json_decode($event->get('extra_fields'),true);
$payload['fromEmail'] = '[email protected]';
$payload['fromName'] = 'John Smith';
return $payload;
}, 10);
Source Files
/events/listeners/send_listing_inquiry_email.php