Answered by:
Database Mail - How to clear queue list ?

Question
-
Hi Experts,
i had a job on my client database which is running every 3 minutes to send out all my mail item list using Database Mail.
This job will automatically send out email which is retrieve from one of my table (DocumentQueue).
So whenever user click "Email" button on my system, system will add record on my table (DocumentQueue)
and every 3 minutes my job will started to send out all email in DocumentQueue which is not being send.
What my problem is... the recipient on my table in the wrong format, ie: admin@google.com;stone.wu@g;
And this email is being send on 09:00.
It keeps sending email every 3 minutes...
on the 1st 10 minutes the errors on sysmail_log was :
"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-10-04T09:28:00). Exception Message: Cannot send mails to mail server. (The specified string is not in the form required for an e-mail address.). )"
and after 10 minutes the errors was :
"The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2010-10-04T12:42:00). Exception Message: Could not connect to mail server. (An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full 10.192.16.56:25). )"
Can anyone help me?? please i need to solve this problem...
Monday, October 4, 2010 6:33 AM
Answers
-
"An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full"
following blog entry explains possible rootcause
Can you check why you are seeing this errors while sending mails using SMTP?. You could write a simple C# app/ use Powershell to send test mails using .NET SMTPClient.
Sample Powershell Code tyo send email:
-----------------------------------------------
$smtpServer = "emailserver"
$smtpPort = 25
$emailFrom = "from@domain.com"
$emailTo = to@domain.com$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Port = $smtpPort$subject = "subject "
$body = "body "
$smtp.Send($emailFrom, $emailTo, $subject, $body)If you are looking for ways to clear Database Mail logs,you could run sysmail_delete_mailitems_sp http://msdn.microsoft.com/en-us/library/ms190293.aspx
Thanks
Sethu Srinivasan [MSFT]
SQL Server Agent Team
- Proposed as answer by WeiLin Qiao Thursday, October 7, 2010 1:37 AM
- Marked as answer by Alex Feng (SQL) Wednesday, October 20, 2010 10:42 AM
Monday, October 4, 2010 5:59 PM
All replies
-
Stone Wu,
The recipient email address should be of correct one.
Please try with TELNET. It will direct you as which error the SMTP server is throwing back during the sending of the message.
Sivaprasad S http://sivasql.blogspot.com Please click the Mark as Answer button if a post solves your problem!Monday, October 4, 2010 9:01 AM -
Hi Stone,
Try to go thru below link. I believe it will help
HTH
Regards Gursethi Blog: http://ms-gursethi.blogspot.com/ ++++++++++++++++++++++++++++++++++++ Please mark "Propose As Answer" if my answer helped +++++++++++++++++++Monday, October 4, 2010 9:18 AM -
"An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full"
following blog entry explains possible rootcause
Can you check why you are seeing this errors while sending mails using SMTP?. You could write a simple C# app/ use Powershell to send test mails using .NET SMTPClient.
Sample Powershell Code tyo send email:
-----------------------------------------------
$smtpServer = "emailserver"
$smtpPort = 25
$emailFrom = "from@domain.com"
$emailTo = to@domain.com$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$smtp.Port = $smtpPort$subject = "subject "
$body = "body "
$smtp.Send($emailFrom, $emailTo, $subject, $body)If you are looking for ways to clear Database Mail logs,you could run sysmail_delete_mailitems_sp http://msdn.microsoft.com/en-us/library/ms190293.aspx
Thanks
Sethu Srinivasan [MSFT]
SQL Server Agent Team
- Proposed as answer by WeiLin Qiao Thursday, October 7, 2010 1:37 AM
- Marked as answer by Alex Feng (SQL) Wednesday, October 20, 2010 10:42 AM
Monday, October 4, 2010 5:59 PM -
Your process needs to trap the error message and mark the email as "sent" or errored or something.
This is not a Database mail problem.
Monday, October 4, 2010 10:07 PM