Skip to content

En Dash In Attachment Filename Causing System.Net.Mail.SmtpException Exception #37

@Gabby-Paolucci

Description

@Gabby-Paolucci

When an attached file has an en dash ("–") in the filename ActionMailerNext is unable to send the email.

Deliver() throws:

Exception

"Failure sending mail."

StackTrace

at System.Net.Mail.SmtpClient.Send(MailMessage message)
at ActionMailerNext.Implementations.SMTP.SmtpMailSender.Send(MailAttributes mailAttributes)
at ActionMailerNext.Mvc5.EmailResult.Deliver()

Inner Exception

"An invalid character was found in the mail header: '–'."

StackTrace

at System.Net.Mail.BufferBuilder.Append(String value, Int32 offset, Int32 count)
at System.Net.Mime.BaseWriter.WriteAndFold(String value, Int32 charsAlreadyOnLine, Boolean allowUnicode)
at System.Net.Mime.BaseWriter.WriteHeader(String name, String value, Boolean allowUnicode)
at System.Net.Mime.MimeWriter.WriteHeaders(NameValueCollection headers, Boolean allowUnicode)
at System.Net.Mime.MimePart.Send(BaseWriter writer, Boolean allowUnicode)
at System.Net.Mime.MimeMultiPart.Send(BaseWriter writer, Boolean allowUnicode)
at System.Net.Mime.MimeMultiPart.Send(BaseWriter writer, Boolean allowUnicode)
at System.Net.Mail.Message.Send(BaseWriter writer, Boolean sendEnvelope, Boolean allowUnicode)
at System.Net.Mail.MailMessage.Send(BaseWriter writer, Boolean sendEnvelope, Boolean allowUnicode)
at System.Net.Mail.SmtpClient.Send(MailMessage message)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions