Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#mail未在我的电子邮件中显示链接_C#_Asp.net_Email_Smtp - Fatal编程技术网

C#mail未在我的电子邮件中显示链接

C#mail未在我的电子邮件中显示链接,c#,asp.net,email,smtp,C#,Asp.net,Email,Smtp,我正在尝试在我的aspx页面中发送带有不可分发链接的电子邮件。但当我检查我的电子邮件id时,它只显示文本。没有联系。这是我生成电子邮件的代码 string bodyContent = CKEditor1.Text; string userLink = "http://www.abc.in/Message.aspx?action=rmsb&oldsubuser="; string footerL

我正在尝试在我的aspx页面中发送带有不可分发链接的电子邮件。但当我检查我的电子邮件id时,它只显示文本。没有联系。这是我生成电子邮件的代码

                string bodyContent = CKEditor1.Text;
                string userLink = "http://www.abc.in/Message.aspx?action=rmsb&oldsubuser=";
                string footerLink = "</br></br></br>You are receiving this mail because you have subscribed to our newsletter. If you do not wish to receive the mail, Click <a href='" + userLink + "" + ids[i].ToString() + "'>Here</a>";                    
                bodyContent = bodyContent + footerLink;
                EmailSend newsletter = new EmailSend();
                newsletter.NewsLetterSend(ids[i].ToString(), bodyContent.Replace("'", "''"), txtSubject.Text.Replace("'", "''"));
                //EmailSend.SendMailMessage("faredpt@gmail.com", ids[i].ToString(), "", "", txtSubject.Text, bodyContent);
                bodyContent = bodyContent.Replace(footerLink, " ");
现在此代码已成功发送电子邮件,但无法在我的电子邮件中添加链接。它显示简单的文本
请告诉我为什么会发生这种情况

你能试着用




替换



吗?可能是因为无效的
br
标记,您的电子邮件被视为无效的HTML,链接被破坏。

您正在用两个引号替换
href
中的引号

无效语句:
bodyContent.Replace(“”,“”)

这将使您的HTML无效。

bodyContent.Replace(“”,“”)
为什么会发生这种情况?
 public void NewsLetterSend(string getemailAdd, string msgBody, string subject)
        {
            MailMessage mail = new MailMessage();

            //set the addresses
            mail.From = new MailAddress("admin@abc.in", "admin@abc.in");
            mail.To.Add(getemailAdd.Trim());

            //set the content
            mail.Subject = subject;
            mail.IsBodyHtml = true;
            mail.Body = msgBody;
            mail.Priority = MailPriority.High;


            //set the smtp settings
            SmtpClient smtp = new SmtpClient("abc.in");
            smtp.EnableSsl = false;

            smtp.Credentials = new System.Net.NetworkCredential("admin@abc.in", "i@abc!23#");
            //smtp.Port = 3535;
            smtp.Port = 25;
            //send email
            smtp.Send(mail);
            return;
        }