I would like to create an Email trigger scheduler , if possible, without using cron
, and would like to know if you can do this through MySQL >.
Searching the Internet I've seen some examples of creating a non-cron event :
CREATE EVENT PurgeLogTable
ON SCHEDULE EVERY 1 WEEK
DO
BEGIN
DELETE FROM 'logs' WHERE 'LogTime' <= DATE_SUB(CURRENT_TIMESTAMP,INTERVAL 1 WEEK);
INSERT INTO 'audit' ('AuditDate', 'Message') VALUES(NOW(), "Log table purged succesfully!");
END
And an example of triggering email using trigger , I just do not know if it works because I did not test:
CREATE TRIGGER send_emailverifier AFTER INSERT, UPDATE ON tbl_users
FOR EACH ROW BEGIN
SELECT * FROM email_bodies WHERE EmailID = 1;
SELECT * FROM tbl_users WHERE ClientID = @ClientID
INSERT INTO tbl_emailverify VALUES (UUID, tbl_users.ClientID, OLD.CltEmail, NEW.CltEmail)
SELECT concat("To: ",NEW.CltEmail & "," & OLD.CltEmail),
"From: [email protected]",
concat("Subject: ",NEW.subject),
"",
email_bodies.EmailContent
INTO OUTFILE "/inetpub/mailroot/pickup/mail.eml"
FIELDS TERMINATED by '\r\n';
END
But my question is pertinent as to how you could tell an email trigger to trigger the submit URL, for example:
/enviar-emails/go