-1

How to send Hyper Link in mail body. I am not able to send a link it is taken as a string. Using code:

string tempurl = "http://jcr.vidyoeval.ril.com/flex.html?roomdirect.html&key=j8XPnetS2l";
var mail_body = "mailto:" + "" + "?body=" + tempurl + "&subject=" + "Let us talk on JioHuddle";

// string mailto = string.Format("mailto:{0}?Subject={1}&Body={2}", "", "Let us talk on JioHuddle", tempurl);
System.Diagnostics.Process.Start(mail_body);
Murat Gündeş
  • 852
  • 2
  • 17
  • 31
Shefali
  • 1
  • 1

1 Answers1

-2

Wrap the url in an "a href= ... " like this:

var mail_body = "mailto:" + "" + "?body=<a href='"+ tempurl + "'>&subject=" + "Let us talk on JioHuddle"
D Ie
  • 841
  • 7
  • 23
  • Why the downvotes? I would accept an explanation... I also think that the 'mailto' word in the question is misleading, he seems to want to send just an hyperlink in the mail body according to "How to send Hyper Link in mail body. I am not able to send a link it is taken as a string" But of course, it's better to downvote just looking at the question's title than thinking 20 seconds about it Editing: btw, according to this, I don't think it is a duplicate question – D Ie Sep 25 '17 at 08:48
  • Reasons for my downvote: (1) The HTML you are generating is broken (no closing tag). (2) The URL cannot be inserted into the body like that (OP’s URL contains ampersands and would need to be encoded first). (3) This does not work at all, suggesting that you haven’t bothered to test it yourself. As the answers in the linked question explain, you *cannot* set content other than plain text using `mailto:` links. So you cannot use HTML, and those links will not render as links. – poke Sep 25 '17 at 09:42
  • Ok thanks, i didn't see the ampersands in the url, would it be safe to say that without them it could work? I tested the HTML in a MailMessage object, within its .Body property and nothing strange happened... Though I still think @Shefali meant to ask his question without the 'mailto' connotation, that's for him to answer hehe Anyways, THANK YOU for your explanation, I really mean it! The community feedback is the thing that got me fall in love with SO, made me put it as my starting page, and finally made me create an account in order to be of some help besides getting it for free :) – D Ie Sep 25 '17 at 14:08
  • btw, my HTML has a closing tag – D Ie Sep 25 '17 at 14:08
  • With closing tag I meant `` which is necessary to make a proper link (also the actual link text between the tags). And no, encoding the URL will make this a valid `mailto:` protocol usage but will still not work to generate an actual link since email clients will only understand this as plain text but not interpret this. – It’s different in MailMessage since that is an actual message object that may contain HTML content but for the `mailto:` protocol, this simply doesn’t work. – Btw. it’s nice to see you wanting to give back to Stack Overflow :) – poke Sep 25 '17 at 14:37
  • i have tried "href" but not working, send as string with href tag – Shefali Sep 26 '17 at 05:11