el_M
el_M

Reputation: 159

Mailkit Email not showing as clickable link

I am trying to send a confirmation email and everything is working except that the link comes through as plain text and not as a clickable link.

This is my code:

        public static Task SendEmailConfirmationAsync(this IEmailSender emailSender, string email, string link)
    {
        return emailSender.SendEmailAsync(email, "Please Confirm your email",
            $"Please confirm your account by clicking this link: <a href='{link}'>link</a>");
    }

Screenshot of email link

Thank you in advance

Upvotes: 1

Views: 1722

Answers (3)

Osman Ulutaş
Osman Ulutaş

Reputation: 11

you must sent us mail template. how are you writing on html page this code. get link only like string and create a mail template and in a tag write like MailText = MailText.Replace("[FirstName]", user.FirstName).Replace("[email]", user.Email).Replace("[URL]", URL) and in html you must write <a href="[URL]">Click Here</a>

Upvotes: 0

Hein B
Hein B

Reputation: 67

using NETCore.MailKit.Core;

Add true for html type: EmailService.Send(user.Email, "Reset Password", $"Please reset your password by clicking here: link",true)

Upvotes: 0

Lews Therin
Lews Therin

Reputation: 3777

Be sure to check that whatever email client you are using is displaying the email as HTML. It appears from your screenshot that the email is being displayed in plain text.

Upvotes: 2

Related Questions