In my code, i am sending mail from an smtp server. I use the code snippet -
SmtpClient client = new SmtpClient();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
Besides Network, there are other ways too. What is the significance of these things ? The official docs don't make it clear.
The SmtpClient type is obsolete on some platforms and not recommended on others; for more information, see the Remarks section.
Delivery methods include: An SMTP server. Moving the email into the pickup directory for IIS, which then delivers the message. Moving the email to a directory specified by PickupDirectoryLocation for later delivery by another application.
Sends the specified email message to an SMTP server for delivery. The message sender, recipients, subject, and message body are specified using String objects. SendAsync(MailMessage, Object)
I found the answer to my own question at - http://www.codeproject.com/Articles/66257/Sending-Mails-in-NET-Framework
Luckily, my search words accidentally landed me on the right page.
Changing Mail Delivery Method You can specify that messages sent do not go to the SMTP server. Instead, it is sent to a directory in your computer that you specify. Actually, it is a good idea when it comes to testing your application. Thus, decreases the testing time.
SmtpClient supports two properties for changing mail delivery location; they are DeliveryMethod and PickupDirectoryLocation properties. DeliveryMethod specifies the delivery method that would be taken when sending the message. This property is of type SmtpDeliveryMethod enumeration; therefore, it can be set to one of three values:
Network: (default) The message is sent via the network to the SMTP server.
PickupDirectoryFromIis: The message is copied to the mail default directory of the Internet Information Services (IIS).
SpecifiedPickupDirectory: The message is copied to the directory specified by the property PickupDirectoryLocation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With