Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

Is it possible to send a email after a new row is added to a SQL table

$
0
0

I'm running MariaDB SQL server on Debian linux, I have phpmyadmin installed. SSMTP is installed and configured so I can send emails from the command line.

I have a simple table, called team_members and every time a new team member is added to the table, a new row with unique ID is created, I would like to know how to send what has been added to the table as an email.

+------------+--------------+------+-----+---------------------+----------------+
| Field      | Type         | Null | Key | Default             | Extra          |
+------------+--------------+------+-----+---------------------+----------------+
| id         | int(11)      | NO   | PRI | NULL                | auto_increment |
| nickname   | varchar(255) | NO   | UNI | NULL                |                |
| first_name | varchar(255) | NO   |     | NULL                |                |
| last_name  | varchar(255) | NO   |     | NULL                |                |
| email      | varchar(255) | NO   | UNI | NULL                |                |
| timestamp  | timestamp    | NO   |     | current_timestamp() |                |
+------------+--------------+------+-----+---------------------+----------------+

I understand that this is possible using a trigger, but I don't really understand how it works.

Could anyone possibly give me an example of how to achieve this.

This table is not going to be updated very often, maybe once a month, so its not going to cause lots of unwanted emails.

Thanks in advance.


Viewing all articles
Browse latest Browse all 29748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>