Send some fields in the mail
Posted: 2022-01-19 15:56
Hi everyone.
I used this code to send an email after updating the page.
The email sends all the fields of the DB.
Would it be possible to send only some fields?
Could you explain to me how to do it?
Thanks so much.
I used this code to send an email after updating the page.
Code: Select all
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]',
'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;
}
Would it be possible to send only some fields?
Could you explain to me how to do it?
Thanks so much.