/// <summary> /// Creates a MimePart object with the content of the file located at the given path. /// </summary> /// <param name="path">File containing the content of the MimePart.</param> /// <param name="generateContentId">If true, a Content-ID Header field will be added to allow referencing of this part in the message.</param> /// <param name="charset">If the file contains text, the charset of the text can be provided to ensure better handling.</param> public MimePart(string path, bool generateContentId, string charset = null) : this(File.ReadAllBytes(path), MimeTypesHelper.GetMimeType(Path.GetExtension(path)), Path.GetFileName(path), charset) { if (generateContentId) { SetContentId(); } }
/// <summary> /// Creates a MimePart object with the content of the file located at the given path. /// </summary> /// <param name="path">File containing the content of the MimePart.</param> /// <param name="contentId">The Content-ID Header field will be used for the part.</param> /// <param name="charset">If the file contains text, the charset of the text can be provided to ensure better handling.</param> public MimePart(string path, string contentId, string charset = null) : this(File.ReadAllBytes(path), MimeTypesHelper.GetMimeType(Path.GetExtension(path)), Path.GetFileName(path), charset) { ContentId = contentId; }
public MimePart(byte[] attachment, string fileExtension) : this(attachment, MimeTypesHelper.GetMimeType(fileExtension), fileExtension) { }