[英]Write message to folder on the disk using MailKit
I'm trying to move an application that used System.Net.Mail over to MailKit/MimeKit. 我正在尝试将使用System.Net.Mail的应用程序移至MailKit / MimeKit。
Using System.NetMail, you could write messages to a folder like so: 使用System.NetMail,您可以将消息写入文件夹,如下所示:
_smtp = new SmtpClient()
{
DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory,
PickupDirectoryLocation = path //path could be a string like "C:\Temp"
};
_smtp.Send(message);
Is there a solution to do this using MailKit/MimeKit? 有没有使用MailKit / MimeKit做到这一点的解决方案?
Thanks for the help! 谢谢您的帮助!
Yes, but it doesn't involve MailKit's SmtpClient... 是的,但是它不涉及MailKit的SmtpClient ...
Instead, you'd do this: 相反,您可以这样做:
MimeKit.MimeMessage message = CreateMyMessage ();
message.WriteTo (fileName);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.