6
I would like to create a e-mail trigger scheduler, without the use of cron, and would like to know if it is possible to do this through Mysql.
Searching the Internet I saw some examples of event creation no use of cron:
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 email firing using Trigger, I just don’t know if it works because I haven’t tried it:
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 I could warn an email trigger, so that it triggers the sending URL, example:
/enviar-emails/go
Thanks for the clarification.
– Ivan Ferrer