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 1026619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:06:39+00:00 2026-05-16T12:06:39+00:00

I am trying to send a message with attachment using CDO object. When the

  • 0

I am trying to send a message with attachment using CDO object. When the SMTP Server is available and all the information is correct, the message is correctly sent with the attachment.

However, if the SMTP Server is incorrect the message is not sent (as expected), but it seems to be “stuck” somewhere. I am using:

Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2

I’ve searched over the Internet, and found that this option would give a 60 second timeout. But the file I attached to the message is never available.

The test that I’ve done is to send a message with an attached file and using an invalid SMTP Server. Then, I wait for a few minutes and try to delete the file I had attached. However, when I try do it, I have a permission problem. When I kill the sending email program, I am able to delete the file.

I want to know how to configure the timeout to make sure it gives up sending the message, how I “detach” the file when the message is not sent and how to make the program wait for the message to be sent (I want to send the message and then erase the attached file from the computer. So I need to know when the message was really sent or when it was timedout).

  • 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-05-16T12:06:40+00:00Added an answer on May 16, 2026 at 12:06 pm

    CDO is hopelessly obsolete, you really need to consider switching to System.Net.Mail. The specific problem sounds like a file locking issue. Quacks like a bug in CDO, it would open the attachment to compose the email message but forgets to close the file when the SMTP server balks.

    This bug is probably exacerbated by the way .NET deals with COM servers, like CDO. The COM object doesn’t get released until the garbage collector runs. Which can take a while, especially when your program doesn’t do anything significant after trying to send the email. A workaround for that is calling Marshal.ReleaseComObject() on the CDO object. Tends to not work when you have other CDO interface references in your program, those references tend to be hidden. GC.Collect() + GC.WaitForPendingFinalizers() is the big hammer, after you nulled any object reference.

    But, really, use System.Net.Mail.

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

Sidebar

Related Questions

I am trying to send an smtp email through gmail's smtp server using the
I am trying to send a message, using MailCore framework in iOS. This is
I'm trying to send post using API feed. I set fields: message , link
I have been trying to send a big attachment (9 MB) using C# ASP.NET
I have been struggling with trying to send an email with an attachment using
I am trying to create a PHP function to send an e-mail using SMTP
I'm trying to send-retrive message from server by SOAP... but soapConnection.call( soapMessage, endpoint )
I am trying to send some message through Websocket to the server. The web
I'm trying to send message using tibrvsend command. The scenarios is like below ,
I'm trying to send email via Amazon SES new SMTP service using .NET's built-in

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.