Sending birthday emails based on Mysql query

Asked

Viewed 474 times

3

I have to create a function (task) on the server of my site that sends a birthday email, containing an HTML code, to birthday emails.

Detail: these birthdays are registered in a Mysql table that contains name, e-mail and date of birth. Therefore, if there are names in this table whose day and month are equal to today’s date, send the birthday e-mail to these names.

Therefore, the task would be to integrate with Mysql and send these emails depending on the result of the query (day and month equal to the current date, send e-mail. Otherwise, you’re not in charge).

How can I do that?

  • What have you tried?

  • So far, nothing. I know there are companies that offer more software dedicated to this type of thing. But if by task Checker could do this... if you have to create some code in PHP and Javascript, is not the problem. The problem would be how to activate this automatic email sending, always considering it has to be when the email owner’s birthday is today.

  • Will you incorporate this into your website? How do you think to do?

  • I thought of incorporating on the site. But I also thought if the most appropriate solution is not to make a BAT file that is saved on the server and that makes this SQL query to send the emails later.

  • I think you can process on the index... that’s a lot of records?

  • Made the script processing by include no index, we send according to select, and believe to optimize well, you can even send in smtp, which is more difficult to be considered as spam, of course there are other auxiliary rules...

  • The number of records depends a lot on how many birthdays you have on a given day. Sometimes you can have several, sometimes few, sometimes one, sometimes none. Do you have any idea of code? @Andrébaill

  • No, then we would have to elaborate... if you start the code and the tests, I can help you until we come up with a solution.

  • 1

    The best option is to use Cronjob, you create one on your server to always run a url to the php file responsible for firing. Do it once a day, and it’s over! It’s automatic and you’ll only need PHP. The CRONJOB to be done by CPANEL is very simple!

Show 4 more comments

1 answer

1

Guys, I figured out the solution by doing a task and creating a page on my server.

When accessed the page, the email is sent. And the task to open the browser on this page will always happen at 9 am. So is automated page!

Thank you for your answers anyway.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.