Page 1 of 1

Email notification

Posted: 2019-09-10 21:48
by Moh Youba
Hello

I am looking for a help to send email notification once a record is added.

For example, a user add a data, admin receive a message, something like " Hello, a new record just added by 'username'".

Thank you

Re: Email notification

Posted: 2019-09-10 22:52
by Moh Youba
Hello
By following a post on the forum I find this code
code.jpg
code.jpg (133.83 KiB) Viewed 2783 times
but when I try I get this error, any help please
errors.jpg
errors.jpg (17.75 KiB) Viewed 2783 times
Thank you

Re: Email notification

Posted: 2019-09-10 22:59
by Moh Youba
got it, here the correct code

foreach($data as $field => $value){
$messageData .= "$field: $value \n";
}

sendmail(array(
'to' => '[email protected]',
'name' => 'Mohamed Youba',

'subject' => 'Transfert',

'message' => "Un transfert a été envoyé par {$memberInfo['username']}: \n\n" . $messageData
));

return TRUE;
}

Thanks

Re: Email notification

Posted: 2019-10-22 23:04
by Moh Youba
Hello

Any help please. I got this working well, but now I need notification to be sent only every week or month

Thank you

Re: Email notification

Posted: 2019-10-23 14:14
by onoehring
Hi Moh,

do you want the email after insert (as seen in screenshot) or at certain time intervals?
If time intervals, I suggest writing that piece of code in a seperate .php file and then use a simple cron (Linux) or at (windows) to call that script.
If you have no cron available, you could sign up for free here: https://www.cronjob.de

Olaf

Re: Email notification

Posted: 2019-10-23 14:16
by Moh Youba
Hi Olaf

I want to send the email with interval, for example every week
I am going to have a look on your link

Thank you