FoxPro Programming
Sendmail hanging
Gravatar is a globally recognized avatar based on your email address. Sendmail hanging
  Tom
  All
  Oct 12, 2018 @ 08:20am

We have a .Net service that calls a VFP9 exe on a schedule. The VFP9 exe creates emails with attachments that are sent using wwdotnetbridge.dll, SSL. The process will send 200-300 emails a day. No CC's. The issue is that randomly, the call to .Sendmail() hangs and does not return. The timeout is set to 45. When restarted, the same recipient the .Sendmail() hung on, will be successful.

Gravatar is a globally recognized avatar based on your email address. re: Sendmail hanging
  Rick Strahl
  Tom
  Oct 12, 2018 @ 05:59pm

A timeout of 45 is pretty long. You shouldn't have to set this more than a few seconds - otherwise something surely is wrong.

Are you making those calls async or synchronous? If you're using .NET you probably shouldn't call asynchronously because there's a chance for deadlock with the STA threads VFP runs the background tasks on.

Other than that I'm not sure. I assume you're using .NET mode to send the emails? If not, please switch to .NET mode as it is more reliable than the Win32 socket sending.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Sendmail hanging
  Tom
  Rick Strahl
  Oct 15, 2018 @ 07:41am

I am using .Net mode with synchronous calls. Would there be any prompts with in the .Sendmail() that would require user interaction? For what is worth, when the .Sendmail() is hung, the PDF attachment being emailed is locked until the program is aborted.

Thanks for your assistance.

Gravatar is a globally recognized avatar based on your email address. re: Sendmail hanging
  Rick Strahl
  Tom
  Oct 15, 2018 @ 11:51am

No there are no prompts.

I'm not sure what would cause a hang - I'd suspect some issue with the file (a contention or lock issue?). Make sure the file is not open or being opened somewhere else.

The processing goes through the .NET SmtpClient so the actual low level send handling fires through the .NET Framework code.

+++ Rick ---

© 1996-2024