如何发送带超链接的电子邮件 [英] How to send email with hyperlink

查看:170
本文介绍了如何发送带超链接的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



我需要发送带有超链接的电子邮件。怎么做?





希望你理解。



问候,

Shahana



我的尝试:





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


Hope you understand.

Regards,
Shahana

What I have tried:

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;

推荐答案

您需要设置 IsBodyHtml = true ,并提供HTML链接。

这可能有所帮助:发送带有或不带附件的C#中的电子邮件:通用例程。 [ ^ ],该链接的HTML将是:

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


这篇关于如何发送带超链接的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆