Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8564475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:12:33+00:00 2026-06-11T17:12:33+00:00

I have a system that sends emails for me and my clients every day

  • 0

I have a system that sends emails for me and my clients every day in the morning. This process is triggered automatically through access to my website, via an iframe.

Often, I receive the same email twice.

The simple process I created on a MySQL database to control this is as follows:

run this query:

Select clients for send my emails

SELECT name, email FROM clients WHERE DATE_FORMAT(lastsend, '%d/%m/%y') <> DATE_FORMAT(now(), '%d/%m/%y')

Function for send emails

I use vb.net for send emails

Update Table Clients after send all emails

UPDATE clients SET lastsend = Now();

I need a way to lock this down to prevent the same emails from being sent multiple times on the same day.

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:12:34+00:00Added an answer on June 11, 2026 at 5:12 pm

    What you have is a race condition. There are many ways to resolve this, some more robust than others. “Robust” means guaranteeing that there is never a duplicate email.

    Here is a simple way. Add a second date column into your table: SendStart. Set send start to now() before you attempt to send the email and change the WHERE clause to:

    WHERE DATE_FORMAT(lastsend, '%d/%m/%y') <> DATE_FORMAT(now(), '%d/%m/%y') and
          DATE_FORMAT(sendstart, '%d/%m/%y') <> DATE_FORMAT(now(), '%d/%m/%y')
    

    You could still get a race condition between the first query and the second. However, the time span is much smaller, so the likelihood is much, much smaller.

    In the end, you will have a record of both when the email was sent, and whether it was sent (don’t set lastsend unless the send is successful). You can do batch reporting and error handling, for the emails that are unsuccessful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an automatic reporting and notification system written in .net that sends emails
I have written a system that sends HTML marketing emails to a list of
Suppose you have a system on the other side of a network that sends
I have a system that runs like this: main.exe runs sub.exe runs sub2.exe and
I have a small WinForms application that sends notification emails. It works fine with
I have a piece of code that sends email.. heres the code This is
I have a console application that sends customized emails (with attachments) to different recipients
I have a spring scheduled job ( @Scheduled ) that sends emails from my
We have a batch program that incorporates JavaMail 1.2 that sends emails. In our
I have created a registration system that uses AJAX to process the form so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.