title: Is it possible to send an email with MySQL trigger?
body: <p>I have searched over the network about the email trigger in database. Yes, I have found a lot of website which uses trigger to send email. However, most of the website is just teaching people to use the SQL-server trigger...</p>
  
  <p>But I currently am using phpmyadmin (MySQL), I have applied those method in MySQL but it doesn't work.</p>
  
  <p>My question is so simple: How can I make a trigger a to send an email in phpmyadmin (MySQL)?</p>
  
  <p>Somebody says that PhpMyAdmin does not support this out-of-the-box. You need access to your MySql server to create a UDF to send the actual e-mail.
  From here: <a href="http://www.c-sharpcorner.com/forums/sending-email-using-mysql-database" rel="nofollow noreferrer">Check this out.</a></p>
  
  <p>The code below is only used in SQL-server:</p>
  
  <pre><code>CREATE TRIGGER leave_system.email ON leave_system.leave_request
  FOR INSERT
  AS
  BEGIN
      SET NOCOUNT ON;
  
      IF EXISTS (SELECT day_in_advance FROM leave_request WHERE day_in_advance &lt;= 0)
      BEGIN
          EXEC msdb.dbo.sp_send_dbmail
            @recipients = 'whoever@yourcompany.com', 
            @profile_name = 'default',
            @subject = 'Someone was speeding', 
            @body = 'Yep, they sure were.';
      END
  END
  GO
  </code></pre>