Somnath Muluk
Somnath Muluk

Reputation: 57656

PHP automated email script

Id like to generate an automatic email at certain times of the week or daily from my website to certain users. i.e at 12am, or 5pm .I'd like an email reminder sent to user [email protected]. Can anyone point me in the right direction. I have read about cronjob but didn't got much information.

Upvotes: 1

Views: 4752

Answers (3)

Egor Sazanovich
Egor Sazanovich

Reputation: 5089

You need to create php script which will do all work (get data to send, get emails list, send data). After that You need to assign this script to schedule in crontab

Upvotes: 0

Eduard Luca
Eduard Luca

Reputation: 6602

Do you have shell access to your host? Or does the host have CPanel installed?

If you have shell access, you can run the following command:

crontab -e

Then insert a new line like this:

* 0,17 * * * /path/to/php/executable /path/to/script/which/sends/emails.php

This will call your PHP script every day at hours 0 and 17 (12AM and 5 PM). The email sending should be done in /path/to/script/which/sends/emails.php

Upvotes: 1

Marc Costello
Marc Costello

Reputation: 439

You are looking in the right direction... A cronjob would suffice. This would allow you to run a php script on a schedule

Start by looking here

Upvotes: 3

Related Questions