0

Hello,

I am currently working on a project which involves sending email out automatically when certain conditions are met in a MySQL dB using a php script, I have managed to build the email part and works, my question is how do you prevent an email being sent out twice when a condition is met, I only want one email to go out when a certain condition is met, my problem is this will be set as a cron tab so it will be running all the time, is there a variable I can use to prevent duplicate emails

Apologies if I'm not very clear and feel free to ask me for any further info

Cheers
Martin

4
Contributors
16
Replies
57
Views
4 Years
Discussion Span
Last Post by iLikePHP
Featured Replies
  • Want me write up a quick example for you? I use it on pingrglobe.com for a mailing queue. :) Read More

  • I'll get it done for you in an hour or two if I have time, working on PingrGlobe a little(which you should sign up for if you've a website *hint hint*) Read More

  • Since I've not had enough time... You'd want to make a database table such as "queue" and then do: email_id(just because, it's good to have IDs) to(varchar) subject(varchar) message(varchar) sent(int/bool) And then use a cron to send out emails with "sent" = 0, and when sending it out... set "sent" … Read More

0

It's easy enough to set a flag (by user) in the database to indicate that the email has been sent. The more important issue is: Can this set of conditions occur again, necessitating a further email? If so, there has to be some sort of reset process to end the first occurrence and set everything back to "Normal" and unset the flag. Otherwise you have the opposite problem and you'll never send another email after the first.

1

Want me write up a quick example for you?
I use it on pingrglobe.com for a mailing queue. :)

0

Hi iLikePHP

Yes please can you write me a quick example to get me started it will be of great help,

Cheers

1

I'll get it done for you in an hour or two if I have time, working on PingrGlobe a little(which you should sign up for if you've a website hint hint)

1

Since I've not had enough time...
You'd want to make a database table such as "queue" and then do:
email_id(just because, it's good to have IDs)
to(varchar)
subject(varchar)
message(varchar)
sent(int/bool)
And then use a cron to send out emails with "sent" = 0, and when sending it out... set "sent" = 1.

Hope this helps!

0

Thanks, Will have a go later

P.S. I've signed up to PingrGlobe, looks great!!!

Edited by urbanthistleuk

0

Awesome!
You tried PingrGlobe yet? :)
You made an account, but no server... need help?
"urbanthistleuk" is your username if I am correct, and good at matching it here and there. :P

-1

Cool!
If your VPS(judging by "My VPS" :P) is hosting a popular site, I would recommend 30 minute checks.
If you need any help, open a support ticket. :)

0

Hello valued members-

Your current converstation is now off topic. Please continue your converstation about your extrenal, unrelated product either in a chat session or in a new thread within the Business Exchange category.

Users that arrive at this thread would be interested in the original topic.

thank you.

Edited by JorgeM

0

Woop! I just gained the privilege to chat!
<3 DaniWeb

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.