Click here to Skip to main content
15,891,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

I need to send Email with a hyperlink. How to do it?


Hope you understand.

Regards,
Shahana

What I have tried:

C#
public void SendEmail(OEMaster oe, int actionType, string accept)
        {
            try
            {
                string mailTo = string.Empty;
                string mailFrom = string.Empty;
                string mailCC = string.Empty;
                string mailSubject = string.Empty;

                string mailMessage = "Dear Concern,";
                mailMessage += "<br />";
                mailMessage += "<br />";

                switch (actionType)
                {
                    case 1:////Mail From Requester to Line Manager for Approval of Advance Expense Request
                        #region Mail Body
                        mailSubject = "Advance Expense Request.";
                        mailTo = oe.Approver.Email; // this.GetEmailAddress(oe.ApproverID);
                        mailMessage += string.Format("This mail informs you that the following person has submitted his Advance Expance request for your approval. Please logon to Prottasha and approve it through Advance Expence Approver menu.");
                        mailMessage += "<br />";
                        mailMessage += "<br />";
                        mailMessage += "The Details are as follows:";
                        mailMessage += "<br />";
                        mailMessage += "<br />";
                        mailMessage += "Employee: " + oe.Employee.Name;
                        mailMessage += "<br />";
                        mailMessage += "<br />";
                        mailMessage += "Amount:  " + oe.Amount;
                        mailMessage += "<br />";
                        mailMessage += "Required Date:  " + oe.RequireDate;
                        mailMessage += "<br />";
                        mailMessage += "Advance For:  " + oe.Expense.Description;
                        mailMessage += "<a href="http:www.google.com"></a>";

                        #endregion
                        break;
Posted
Updated 20-Aug-16 20:42pm
v3

1 solution

You need to set IsBodyHtml = true, and supply an HTML link.
This may help: Sending an Email in C# with or without attachments: generic routine.[^] and the HTML for that link would be:
<a href="http://www.codeproject.com/Tips/163829/Sending-an-Email-in-C-with-or-without-attachments">Sending an Email in C# with or without attachments: generic routine.</a>[<a href="http://www.codeproject.com/Tips/163829/Sending-an-Email-in-C-with-or-without-attachments" target="_blank" title="New Window">^</a>]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900