-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An invalid character was found in the mail header: ';'. #158
Comments
Hey! Thanks for posting this bug. I actually ran into the same problem today, with the exact same input scenario. I had a series of email strings from a database query coming through and being sent, and the app hit this exception complaining about the input string. The input that triggered the exception was something like I ended up trying both I've gone ahead and started replacing all of my views with this RawString workaround. I can't say that I have any ideas on how to improve on this solution, but I just wanted to thank you for posting and give a heads-up that users might also need to include the using statement I wrote above to get it to work. |
I suspect there is no easy work-around for this issue. I sense the fundamental problem here - email headers should not be a part of Razor template at all, but this is a paradigm shift for this project and unlikely it'll be changed. |
When using RazorEngine the |
We are using |
Just an FYI for anyone else still looking. |
For any fellow sufferers for whom the Raw and RawString didn't work: replace your semicolons with commas. |
Just encountered this issue effecting the subject line. Isn't it easier to decode the HLML entites back into plain text in Postal's EmailParser? Can anyone see any issue with the following:
Expect a similar fix is required for the text body, if a plain-text view is specified. Haven't found where to fix that yet... Edit - I think this should do it:
And for messages with only a text body and no AlternateViews:
|
Thanks for sharing! Identifying and addressing bugs is crucial for maintaining system reliability. Have you tried reviewing recent changes that might have caused this issue? Working apartments collaboratively to debug can lead to a swift resolution. |
I've discovered an interesting bug. Today in production logs I've found the following exception:
I've tracked the issue to an email with an apostrophe. Something like `Mr.O'[email protected]' when using a strongly typed email:
The problem tracks down to RazorEngine doing encoding of all the input. So
Mr.O'[email protected]
is getting translated intoMr.O'[email protected]
. You see where the problem comes from? When trying to add this value toMailMessage.To
- the above exception is thrown.Now I've attempted to replace
@Model.To
with@Html.Raw(Model.To)
, but Razor Engine fails with message "HtmlHelper is not available".Solution I've found is to use
RawString
incshtml
template:But this adds mental overhead and can easily be forgotten when adding new templates. Any ideas how to improve?
The text was updated successfully, but these errors were encountered: