title: sql server 2005 database mail error (The operation has timed out)
body: <p>I have configured Database Mail for sending newsletter emails from sql database. I have a stored procedure that selects the emails of the subscribers and send them the mails like this:</p>
  
  <pre><code>EXEC msdb.dbo.sp_send_dbmail 
  @profile_name = 'ProfileName',
  @recipients = @email,
  @subject = @thesubject,
  @body = @themessage,
  @body_format = 'HTML' ;
  </code></pre>
  
  <p>The account used for sending is working fine coz when I sent the test mail after configuring the Database Mail it was sent successfully but the problem is sending more than one mail.</p>
  
  <p>Currently  there are 50 emails in the table after executing the stored procedure I checked the msdb tables sysmails_event_log, sysmails_faileditems and sysmails_sentitems, I found that only the 1st 12 emails were sent and the rest failed and the error message in the event_log was:</p>
  
  <p>The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2009-12-01T16:55:11). Exception Message: Cannot send mails to mail server. (The operation has timed out.). )</p>
  
  <p>I checked the emails no. 13 and laters and I didn't find anything wrong with them, so I tried executing the procedure again, this time it sent to the 1st 14 email and the rest failed with the same error so I changed the procedure and made it select the mails starting from mail no. 15 
  (as if it will send from record 15 to 50) and tested it, this time it sent to the 1st 13 email, I selected from 27 to 50 and executed, again it sent to the 1st 12.</p>
  
  <p>I don't understand what's going on here what's this behavior of sending mails only in the range of 12-14 mails at a time.</p>
  
  <p>Can anyone help me on this?</p>
  
  <p>Thanks in advance</p>