SQLTeam.com | Weblogs | Forums

Database Trigger - Insert Table Data in Email

sql2014

#1

I'm working on a simple Trigger that sends an email when new information is input. I only need to the email to include the table data. However, I'm not experienced enough to pull it off.. Any input would be very helpful, please remember I'm a neophyte so be kind.. :wink:

BEGIN

DECLARE v_to_address VARCHAR(60) DEFAULT 'Email 1';
DECLARE v_cc_address VARCHAR(60) DEFAULT 'Email 2';
DECLARE v_subject VARCHAR(255) DEFAULT 'New Lead AutoShippingVerified';
DECLARE v_body TEXT DEFAULT 'New Lead';

SET v_body = CONCAT(v_body, '

Add Request', IFNULL(NEW.Mobile_AS_Quote_Data, ''), '

');

INSERT INTO parasql_email_out (to_address, cc_address, from_address, subject, body, html_format)
VALUES (v_to_address, v_cc_address, @CURRENT_USER_GMAIL_ADDRESS, v_subject, v_body, , true);

END