We're building a site that generates HTML emails using RazorEngine.
Using a breakpoint we can see the generated email body is as expected. But the resultant .eml file has an image URL wrap and it seems to be adding an additional dot which of course breaks the URL and prevents the image from being displayed.
The following shows the models BaseUrl in a loop:
And, at the breakpoint just before calling SmtpClient.Send shows the email body as:
The SMTP settings in web.config send it to c:/temp/ and when I look at the resultant eml file in notepad++ we see:
Note the 2nd image link has an additional dot between the "co" and the "uk" that is not present in the other links nor in the final email body.
None of the rest of the team have come across this before on any project.
Are we doing something obviously wrong? Are there "gotchas" we're not aware of?
Any help would be most appreciated.
It turns out that .eml files that are created and saved to disk are not supposed to be opened directly in an email client.
If the .eml file is actually sent then it appears in email client correctly.
Can't remember where I found this info but thought I'd add it as I realised this was still open.
So, if you see similar issues, try sending the email then checking it - don't just save to disk and check it.