من در ASP.NET تگ های یک صفحه ی html رو از یک فایل template که برای ارسال خبرنامه درست کرده ام می خونم و بعضی جاهاش رو از داخل database جاگذاری می کنم بعد ایمیلش می کنم. اما مشکل اینجاست که اولا فرمت بندی صفحه اعمال نمیشه (البته من ایمیل رو در windws server 2003 و outlook express می خونم) ثانیا علامت گیومه " به صورت کد ارسال می شه. ثالثا اون خط آخر که می خوام روش لینک بذارم لینک نمیشه و به صورت متن معمولی نشون داده میشه.
اینم کدی که استفاده کردم:
اینم کدی که استفاده کردم:
PHP:
Dim strreader As StreamReader
Dim strfilename As String = Server.MapPath("send_template.htm")
Dim strfiletext
strreader = File.OpenText(strfilename)
While strreader.Peek > -1
strfiletext += strreader.ReadLine
End While
strreader.Close()
strfiletext = Replace(strfiletext, "#lbldate#", Session("s")(5))
strfiletext = Replace(strfiletext, "#lbltime#", Session("s")(6))
strfiletext = Replace(strfiletext, "#lblcategory#", Session("s")(1))
strfiletext = Replace(strfiletext, "#lblheadline#", Session("s")(0))
strfiletext = Replace(strfiletext, "#lbllead#", Session("s")(2))
strfiletext = Replace(strfiletext, "#lbltext#", Session("s")(4))
strfiletext = strfiletext + "<br /><a href=http://www.iananews.com/english/details.aspx?id=" & Session("s")(3) & ">Click Here to View the Article Online...</a>"
Dim ssender As New MailMessage
ssender.From = New MailAddress(ts.Text)
ssender.To.Add(tr.Text)
ssender.Subject = "News Article from Iranian Agriculture News Agency (IANA)!"
ssender.IsBodyHtml = True
ssender.BodyEncoding = System.Text.Encoding.UTF8
ssender.Body = strfiletext