I'm trying to send an email to several recipients when a new row is inserted into a table. The list of recipients varies. I would like to be able to set this list using a select statement. I also have installed Navicat which allows me to send email notifications but only to a predetermined set of people.
Thanks.
If you have vps or dedicated server, You can code your own module using C programming.
para.h
main.c
To configure your project go through this video: https://www.youtube.com/watch?v=Zm2pKTW5z98 (Send Email from MySQL on Linux) It will work for any mysql version (5.5, 5.6, 5.7)
I will resolve if any error appear in above code, Just Inform in comment
If you have an SMTP service running, you can outfile to the drop directory. If you have high volume, you may result with duplicate file names, but there are ways to avoid that.
Otherwise, you will need to create a UDF.
Here's a sample trigger solution:
To markup the message body you will need something like this...
I agree with Jim Blizard. The database is not the part of your technology stack that should send emails. For example, what if you send an email but then roll back the change that triggered that email? You can't take the email back.
It's better to send the email in your application code layer, after your app has confirmed that the SQL change was made successfully and committed.
I would be very concerned about putting the load of sending e-mails on my database server (small though it may be). I might suggest one of these alternatives: