views:

30

answers:

1

i have used a mail function. after inserting every record simultaneously from multiple PC.

I have set a timer which ticks for every 2 min. while it ticks it start to check the record and it send the mail. i have used background worker for that.in Bgdworker the mail fn will be called.

private void timer_Startsendingemail_Tick(object sender, EventArgs e)    
{
    if (!bgw_startsendingemail.IsBusy)
        bgw_startsendingemail.RunWorkerAsync();
}

private void bgw_startsendingemail_DoWork(object sender, DoWorkEventArgs e)
{
    sendingMail();
    sendingsms();
}

in sendingmail(), the datas fetch from database and send the mail based on email settings to all the inserted rec.

but the prob is the timer triggered for 2 min often , and the process will be working fine and nothing there in log file but sometime the mail is not received by the clients.how to fix the prob. how to find out where it is strucked...

its hard to find the problem. any idea over this?

A: 

The problem could be anywhere down the line from your service up to the mail server. Some mail servers only allow n emails to be sent per hour or N emails to be sent per day. Your best bet (if you have access) is to check your SMTP logs. If you do not have access, setup a test SMTP server and tie a copy of your code to that and see if it performs the same or better on your test setup.

Another idea may be to limit the number of emails you send per tick cycle of the timer (200?). You could be overloading some portion of the SMTP server.

Tommy
thanks a lot for this post
Ranjana