Page 1 of 1

Send email to two or more

Posted: 2020-02-02 22:44
by patsd102
This code here works fine from the main site,

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;
}
Is it possible to add more than 1 recipient. or more
I have tried to add a second with a coma, but then none work,

'to' => '[email protected], [email protected] ',

Thanks
Pat

Re: Send email to two or more

Posted: 2020-02-04 19:47
by patsd102
Its okay,
I have found what I need

Re: Send email to two or more

Posted: 2020-04-06 03:33
by utony
Can you sent an email to a whole group instead of a single email address? I don't want to hand code users everyday. It would be nice if we could just add"group1" and it would send to everyone in group1. Can this by done?

Re: Send email to two or more

Posted: 2020-04-06 22:09
by aarlauskas
just create forwarding email and add all in there? Thats what I use anyway.