crossvertise / ActionMailerNext

Fork of ActionMailer.Net, A easy to use library to generate emails with razor views
MIT License
42 stars 24 forks source link

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

Open Gabby-Paolucci opened 7 years ago

Gabby-Paolucci commented 7 years ago

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)