You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the method AttachFromFileName({fileName}, {Content-Type}, {attachmentName}) has only fileName as required and other two including "content-type" as optional. But in the implementation, it seems its expected/required. When i implemented the attachment option with just the fileName parameter only, it throws error
Value cannot be null. (Parameter name 'text')
When i dig deeper into the source code of this, I found like its been expected to parse further down, as ContentType.Parse(text).
Either, make the "content-type" parameter as required or dont expect it further down the line, may be, derive the content type implicitly or auto detect, whichever could solve not to throw such error.
Stack trace details:
at MimeKit.Utils.ParseUtils.ValidateArguments(ParserOptions options, String text)
at MimeKit.ContentType.Parse(ParserOptions options, String text)
at MimeKit.ContentType.Parse(String text)
at FluentEmail.MailKitSmtp.MailKitSender.<>c__DisplayClass5_0.b__0(Attachment x)
at FluentEmail.Core.ListExtensions.ForEach[T](IEnumerable1 enumerable, Action1 consumer)
at FluentEmail.MailKitSmtp.MailKitSender.CreateMailMessage(IFluentEmail email)
at FluentEmail.MailKitSmtp.MailKitSender.d__3.MoveNext()
My code usage/implementation is,
if (File.Exists(file))
{
mailer.AttachFromFilename(file, attachmentName: Path.GetFileName(file));
}
The text was updated successfully, but these errors were encountered:
I think it's actually MimeKit which expects the content type, not this library. The classes in this library are designed to be generic and to work with multiple senders; for example, SmtpSender, which uses the built-in SmtpClient, does not need a content type.
Currently, the method
AttachFromFileName({fileName}, {Content-Type}, {attachmentName})
has only fileName as required and other two including "content-type" as optional. But in the implementation, it seems its expected/required. When i implemented the attachment option with just the fileName parameter only, it throws errorValue cannot be null. (Parameter name 'text')
When i dig deeper into the source code of this, I found like its been expected to parse further down, as
ContentType.Parse(text)
.Either, make the "content-type" parameter as required or dont expect it further down the line, may be, derive the content type implicitly or auto detect, whichever could solve not to throw such error.
Stack trace details:
My code usage/implementation is,
The text was updated successfully, but these errors were encountered: