-1

I would like to send an email to users through Gmail 1 month before of their passport expiry date. I am totally new to programming and I have read somewhere I can achieve it by trigger but I don't know where to start.

I am using XAMPP.

Here's my MySQL table structure:

enter image description here

Email subject should be:

EmployeeName your passport is expiring on Expirydate Please Renew it ASAP

Dharman
  • 30,962
  • 25
  • 85
  • 135
SMD
  • 27
  • 1
  • 5
  • 3
    Unfortunately SO is for programming questions, not really for teaching someone how to program (and especially not for coding requests) – James Z Jan 28 '19 at 07:52

2 Answers2

0

Learn about Cron jobs in PHP. Using it, you can schedule execution of a PHP file.

In your case the PHP File will contain code for checking expiry date and sending mail.

Your PHP file will do these things:

  1. Scan database and look for employees whose passport is about to expire.
  2. Get the email of that employee and send mail using PHPMail

To send mail through Gmail, refer to this repo: PHPMail

abhimanyu singh
  • 103
  • 1
  • 7
0

If you do not know how to use Cron jobs I found that in Windows 10 you can use "Task Scheduler" to create a trigger and then run your script.

Found a good thread on it here.

How do I run a PHP script using windows schedule task?

Dharman
  • 30,962
  • 25
  • 85
  • 135