c# - Sendgrid- unble to concatinate plaintext along with html hyperlink -
i using sendgrid send email when try concatinate plaintext , html hyperlink seems constructed correct in email email html tag.
my code:
string myhtml = string.format(@"<a href='{0}'>here</a>", activationlink); string message = string.format("dear {0} {1}\n", firstname, lastname) + "to verify email address click "; sendmail(email, subject, message, myhtml);
below sendmail method:
public bool sendmail(string to, string subject, string message, string htmlcontent) { try { var client = new sendgridclient(configurationmanager.appsettings["key"].tostring()); emailaddress = new emailaddress(configurationmanager.appsettings["from"].tostring()); var subject = subject; emailaddress = new emailaddress(to); string content = message; //var htmlcontent = "<strong>hello, email!</strong>"; var msg = mailhelper.createsingleemail(from, to, subject, content, htmlcontent); var response = client.sendemailasync(msg); return true; } catch (exception ex) { return false; } }
this in email:
here(clickable)
what want appear in mail is:
dear user verify email address click here (clickable)
can please me.
Comments
Post a Comment