简体   繁体   中英

mvc 5 SendEmailAsync with image

I am trying to send a confirm email when a user registers on my website.

The C# is -

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);

which loads my ConfirmRegistration.html file from the file system. That file is -

<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>

But I can't get the logo to appear.

IS there something special I need to do to get that image to appear?

Also, I need to continue to use SendEmailAsync

您必须将其包含在绝对网址中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM