2014-12-05 88 views
0

我想在用戶在我的網站上註冊時發送確認電子郵件。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

回答

1

你必須把它列入絕對URL。