asp.net - Attatch Gridview to email body VB.NET -


i sending emails programatically in web page, emails work fine attach gridview email body.

this vb code have sending email far...

dim uname string = page.user.identity.name.substring(page.user.identity.name.indexof("\") + 1)             strfm = uname + "@inscapepeople.co.uk"             if strto <> ""                 dim insmail new system.net.mail.mailmessage(new mailaddress(strfm), new mailaddress(strto))                 insmail                     each y string in strtorest.split(";")                         if y = ""                         else                             .cc.add(y)                         end if                     next                     .subject = subject                     .body = greet + "<br />" + "<br />" + bodytxt.text + "<br />" + pname + "- " + pnum + "<br />" + "<br />" + "the required date was: " + reqdatenow.text + " ,the required date now: " + reqdateafter.text + "<br />" + "regards," + "<br />" + "<br />"                     .isbodyhtml = true                     sig = uname                     if sig.tolower = "djones" sig = "gbennett"                     dim source string = path + sig + ".jpg"                     if system.io.file.exists(source) = false                         msgbox.showalertmessage("signature not found, email still sent.")                     else                         dim lr new linkedresource(source)                         lr.contentid = "signature"                         dim htmlview alternateview = alternateview.createalternateviewfromstring(insmail.body + "<img width=""500"" height=""400"" src=cid:signature>", nothing, "text/html")                         htmlview.linkedresources.add(lr)                         .alternateviews.add(htmlview)                     end if                 end                 dim smtp new system.net.mail.smtpclient                 smtp.enablessl = false                 smtp.host = "192.168.50.2"                 smtp.port = 25                 smtp.usedefaultcredentials = true                 smtp.send(insmail) 

i have searched around online , cannot find me, wondering if assistance this, thank in advance.

any @ appreciated.

i suggest converting gridview html using function such as:

private function gridviewtohtml(byval gv gridview) string     dim sb new stringbuilder     dim sw new stringwriter     dim hw new htmltextwriter(sw)     gv.rendercontrol(hw)     return sb.tostring() end function 

then call function , add body of email.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -