As the title, is MailKit supported to send file?
If yes, how can I do it?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Yes. This is explained in the documentation as well as the FAQ.
From the FAQ:
How do I create a message with attachments?
To construct a message with attachments, the first thing you'll need to do is create a
multipart/mixed
container which you'll then want to add the message body to first. Once you've added the body, you can then add MIME parts to it that contain the content of the files you'd like to attach, being sure to set theContent-Disposition
header value to attachment. You'll probably also want to set thefilename
parameter on theContent-Disposition
header as well as thename
parameter on theContent-Type
header. The most convenient way to do this is to simply use the MimePart.FileName property which will set both parameters for you as well as setting theContent-Disposition
header value toattachment
if it has not already been set to something else.A simpler way to construct messages with attachments is to take advantage of the BodyBuilder class.
For more information, see Creating Messages.