mvc 5 SendEmailAsync with image

问题描述:

我想在用户在我的网站上注册时发送确认电子邮件。mvc 5 SendEmailAsync with image

C#的是 -

string baseDirectory = System.AppDomain.CurrentDomain.BaseDirectory; 

string confirmRegistrationEmail = System.IO.File.ReadAllText(baseDirectory + "Content\\ConfirmRegistration.html").Replace("#logo", baseDirectory + "Content\\Images\\logo.png"); 

await UserManager.SendEmailAsync(_user.Id, "Confirm your account", confirmRegistrationEmail); 
从文件系统加载我ConfirmRegistration.html文件

。该文件是 -

<html> 
<body> 
    <img src="#logo" alt="Logo" align="middle"> 
    <br> 
    <b>Thank you for registering with Example Website.</b> Your account has been created.<br> 
    <p align ="justify"> <a href="#callbackURL">Click here to confirm and complete the registration process.</a></p> 
</body> 
</html> 

但我不能让徽标出现。

有什么特别的我需要做的,让图像出现?

另外,我需要继续使用SendEmailAsync

+1

您必须将其包含在绝对网址中。 – 2014-12-05 15:17:17

你必须把它列入绝对URL。