Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2009

Tip: Looking for answers? Try searching our database.

Knowledge Base: Generating e-mails in ASP.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Blue Streak - 10 Mar 2005 23:21 GMT
Hello,

   I am trying to develop an interface to view an internal knowledge base.  One feature I would like to add is a "Generate E-Mail" button which would automatically open an e-mail message a populate it with the title and the article from the knowledge base.   Each KBase item contains a title and article where the article contains HTML formatting.  So far, I have used a client-side JavaScript block to perform this task along with an HTML control.

i.e.
<INPUT onclick=GenerateEMail() type=button value="Generate E-mail" name=btnEmail />
...
function GenerateEMail()
{
   oDiv = document.all.pnlArticle;
   oDiv.contentEditable = 'true';
   if (oDiv.innerHTML != '')
    {
     subject = escape(document.frmKBase.lstTitle.options[document.frmKBase.lstTitle.selectedIndex].text);
     var controlRange;
     if (document.body.createControlRange)
     {
         controlRange = document.body.createControlRange();
         controlRange.addElement(oDiv);
         controlRange.execCommand('Copy');
         oWin = window.open('mailto:somebody@nowere.com?subject='+ subject);
     }
     oDiv.contentEditable = 'false';
   }
   else
   {
     alert('Please select an article!');
   }

I use the copy command to the clipboard so that the HTML formatting is not lost.  The problem with this method is that you need to perform a paste when the e-mail message window opens up.

Is there a way to have the article pasted automatically?

Is there a way of doing this all in ASP.NET?

TIA
Matt Berther - 12 Mar 2005 02:46 GMT
Hello Blue,

Try something (code from memory, so it may not be perfect) like this hooked
up to a button:

string html = "";

using (StringWriter sw = new StringWriter())
{
   Html32TextWriter hw = new Html32TextWriter(sw);
   pnlArticle.RenderControl(hw);
   hw.Close();
   html = sw.ToString();
}

At this point, you have an HTML representation of the content in the pnlArticle
panel. Look at System.Web.Mail [1] for information on how to send the email.
You'll want to make sure to set the MailFormat property.

[1] http://www.systemwebmail.net

--
Matt Berther
http://www.mattberther.com

> Hello,
>
[quoted text clipped - 46 lines]
>
> TIA...
Blue Streak - 14 Mar 2005 16:03 GMT
Thank you much!

> Hello Blue,
>
[quoted text clipped - 70 lines]
> >
> > TIA...
milto - 30 Oct 2009 23:38 GMT
quiero

From http://www.google.com.ec/search?hl=es&client=firefox-a&channel=s&rls=org.mozilla
:es-ES:official&hs=Ysf&q=www.owin3d.ec&btnG=Buscar&meta=&aq=f&oq


Posted via DevelopmentNow.com Group
http://www.developmentnow.com/g/

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.