Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 26th, 2012, 05:19 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

>> it says that there are no useable controls for a txt file

Where does it say that? You should be able to modify the text file without getting errors like this. Here's a quick example (place this code in ContactForm.txt in the App_Data folder):

Code:
 
Hi there,<br /><br />
A user has left the following feedback at the site:<br /><br />
<table class="auto-style1">
  <tr>
    <td>
      Name:
    </td>
    <td>
      ##Name##</td>
  </tr>
  <tr>
    <td>
      E-mail address: </td>
    <td>
      ##Email##</td>
  </tr>
  <tr>
    <td>
      Home phone: </td>
    <td>
      ##HomePhone##</td>
  </tr>
  <tr>
    <td>
      Business phone: </td>
    <td>
      ##BusinessPhone##</td>
  </tr>
  <tr>
    <td>
      Comments: </td>
    <td>
      ##Comments##</td>
  </tr>
</table>
Then when sending the e-mail, set IsBodyHtml to true like this (in ContactForm.ascx.cs):

Code:
 
myMessage.Subject = "Response from web site";
myMessage.Body = mailBody;
 
myMessage.From = new MailAddress(AppConfiguration.FromAddress, AppConfiguration.FromName);
myMessage.To.Add(new MailAddress(AppConfiguration.ToAddress, AppConfiguration.ToName));
 
myMessage.IsBodyHtml = true;
 
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
Hope this helps,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Email Question: Chp 9 nanonerd BOOK: Beginning ASP.NET 4 : in C# and VB 1 March 12th, 2012 03:34 AM
Question regarding automatic email SpellingBee Access VBA 0 April 27th, 2010 10:19 AM
Question about email digink BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 October 14th, 2009 03:39 PM
Email question... iceman90289 ASP.NET 3.5 Basics 9 August 29th, 2009 09:44 AM
SMTP Email question snufse ASP.NET 2.0 Basics 2 July 9th, 2009 11:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.