.NET SMTPClient – where is pending outgoing mail stored


If I've queued up some email to be sent via the System.Net.Mail.SMTPClent, where can I find this mail? With the Windows SMTP Client, it's in the C:\inetpub\mailroot folder – is there a similar folder for the .NET client?

EDIT: Here's an example. If I turn off the outgoing SMTP server on my XP computer and then run an application that sends a dozen emails, they get queued up somewhere, since the .NET SMTPClient.Send call succeeds. A few hours later, I start the local SMTP server, and the mail leaves in a sudden flurry. Where is it in the meantime? The same behavior happens on my Vista desktop, though I have no local SMTP server – I can duplicate the functionality by blocking port 25 on the firewall, and then mail queues up somewhere. Where?

The reason for this question is that I want to re-enable the SMTP Service on a server I have, but I don't know what's been queued up in the meantime, and I want to make sure the queue is clean when I re-enable the service. That way, customers don't get really, really old queued emails all of the sudden.

EDIT: Clearly, I don't know what I'm talking about. When I do this on Vista:

    Dim mm As New System.Net.Mail.MailMessage("me@me.com", "you@you.com", "Testing", "this is a test")

    Dim s As New System.Net.Mail.SmtpClient("localhost")
    s.DeliveryMethod = Mail.SmtpDeliveryMethod.PickupDirectoryFromIis

I get an exception because I don't have an IIS pickup folder. Changing it to "Mail.SmtpDeliveryMethod.Network" results in an immediate exception because I don't have an SMTP server running. I'll test this on server 2003, but I could have sworn that these both worked in the past. I'll do some more testing and modify the question if needed.

Best Solution

From the looks of the MSDN pages for SmtpClient, it's configurable. You can use the DeliveryMethod property to decide whether mail is sent immediately, whether it's queued into the IIS pickup folder (presumably C:\inetpub\mailroot) or whether it's placed in a folder of your choosing (specified by the PickupDirectoryLocation property).