Sending email to multiple receipt
Posted: 2020-10-08 09:32
Good morning,
I wanted to send an email to multiple recipients via hook, but it doesn't work.
function tablename_after_insert($data, $memberInfo, &$args){
// to compose a message containing the submitted data,
// we need to iterate through the $data array
foreach($data as $field => $value){
$messageData .= "$field: $value \n";
}
sendmail(array(
'to' => '[email protected], [email protected]',
'name' => 'Recipient Name',
'subject' => 'A new record needs your attention',
'message' => "The following new record was submitted by {$memberInfo['username']}: \n\n" . $messageData
));
return TRUE;
}
Can you help me understand how to solve?
Many thanks in advance.
I wanted to send an email to multiple recipients via hook, but it doesn't work.
function tablename_after_insert($data, $memberInfo, &$args){
// to compose a message containing the submitted data,
// we need to iterate through the $data array
foreach($data as $field => $value){
$messageData .= "$field: $value \n";
}
sendmail(array(
'to' => '[email protected], [email protected]',
'name' => 'Recipient Name',
'subject' => 'A new record needs your attention',
'message' => "The following new record was submitted by {$memberInfo['username']}: \n\n" . $messageData
));
return TRUE;
}
Can you help me understand how to solve?
Many thanks in advance.