For simplicity, I'll just quote an explanation from a Connect item:
You can actually configure the
SmtpClient to send emails to the file
system instead of the network. You can
do this programmatically using the
following code:
SmtpClient client = new SmtpClient("mysmtphost");
client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
client.PickupDirectoryLocation = @"C:somedirectory";
client.Send(message);
You can also set this up in your
application configuration file like
this:
<configuration>
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<specifiedPickupDirectory pickupDirectoryLocation="C:somedirectory" />
</smtp>
</mailSettings>
</system.net>
</configuration>
After sending the email, you should
see email files get added to the
directory you specified. You can then
have a separate process send out the
email messages in batch mode.
You should be able to use the empty constructor instead of the one listed, as it won't be sending it anyway.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…