 |
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
 | This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 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
|
|
|
|

October 23rd, 2007, 05:44 PM
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Emails not formatted correctly.
Hi Imar,
I have the emails sending out from my domain name once I finalize an order. The only issue is that the emails are not formatted correctly. I can see all of the html tags in my emails. How do we get around this. I have provided what is being sent to my inbox. Please help.
<html>
<head>
<title>Your Order Carefree Jewelry Online</title>
</head>
<body>
Dear customer,<br /><br />
Thank you for your order at Carefree Jewely Online. Your order number is
<b>6</b><br /><br />
Below you find a list of the products you have ordered. The goods will ship as
soon as we receive your payment.<br /><br />
<div>
<table cellspacing="0" rules="all" border="1" style="border-width:1px;border-style:solid;width:100%;border-collapse:collapse;">
<tr align="left" style="color:White;background-color:#ffb49f;font-family:Arial;">
<th scope="col">Title</th><th scope="col">Quantity</th><th scope="col">Price</th><th scope="col">Total</th>
</tr><tr style="color:Black;background-color:White;font-family:Arial;">
<td>this is a test</td><td align="right">1</td><td align="right">12.0000</td><td align="right">12.0000</td>
</tr><tr style="color:Black;background-color:White;font-family:Arial;">
<td>this is a test</td><td align="right">1</td><td align="right">12.0000</td><td align="right">12.0000</td>
</tr><tr style="font-family:Arial;font-weight:bold;">
<td>Totals:</td><td> </td><td> </td><td align="right">$24.00</td>
</tr>
</table>
</div>
<br /><br />
Thanks<br /><br />
The Carefree Jewelry Team
</body>
</html>
|

October 24th, 2007, 02:05 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Normally, with HTML mail, you would only send the mail body, so you can (should) leave this out:
<html>
<head>
<title>Your Order Carefree Jewelry Online</title>
</head>
<body>
Also, don't forget to mark the message as an HTML message when you send it.
BTW, it would be nice if you posted some follow up on answers I post here. I give you a lot of support for free and never hear anything back. I don't even know if you bought the book or just downloaded the shop's source....
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|

October 24th, 2007, 10:52 AM
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
I do have the book and I followed the enhancements for the automated emails to a T and I still am not seeing the email formatted correctly. I just took out the
<html>
<head>
<title>Your Order Carefree Jewelry Online</title>
</head>
<body> form the confirmationmessage.txt file and resent the emails. The emails are still formatted incorrectly. The only issue thing Im not clear about is where to flag this "Also, don't forget to mark the message as an HTML message when you send it."
Do you mean this piece of code.
Dim theSubject As String = "Your order at Carefree Jewelry"
Dim theMessage As String = My.Computer.FileSystem.ReadAllText _
(AppConfiguration.ConfirmationMessageLocation)
Dim mySmtpClient As New System.Net.Mail.SmtpClient
theMessage = theMessage.Replace("##ShoppingCart##", _
GetHtmlFromControl(myGridView))
theMessage = theMessage.Replace("##OrderNumber##", orderId.ToString())
mySmtpClient.Send("info@carefreejewelry.com", emailAddress, theSubject, theMessage)
End If
|

October 24th, 2007, 03:32 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Odd, code like that should send, AFAIK, HTML formatted mail by default. This may work instead (taken from the Blog chapter):
Code:
Dim mySmtpClient As SmtpClient = New SmtpClient()
Dim myMessage As MailMessage = New MailMessage( _
AppConfiguration.EmailFrom, AppConfiguration.EmailTo, subject, _
errorMessage.ToString())
myMessage.IsBodyHtml = True
mySmtpClient.Send(myMessage)
This code creates a new MailMessage and sets its IsBodyHtml property to true.
Are you sure you have a mail client that understands HTML?
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Paper Cup Exit by Sonic Youth (Track 8 from the album: Sonic Nurse) What's This?
|

October 24th, 2007, 06:51 PM
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have tried webmail as well as Lotus Notes. I know lotus notes excepts html emails. I am trying the new code now and will post back with the results.
Thanks for the help.
|

October 25th, 2007, 07:48 PM
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
This was it myMessage.IsBodyHtml.
This is what got it working.
thanks,
Matt
|

November 7th, 2007, 05:45 AM
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Could you tell me what you changed to get it working because i am stuck on the same problem
dit you just changed the code from:
Dim theSubject As String = "Your order at Carefree Jewelry"
Dim theMessage As String = My.Computer.FileSystem.ReadAllText _
(AppConfiguration.ConfirmationMessageLocation)
Dim mySmtpClient As New System.Net.Mail.SmtpClient
theMessage = theMessage.Replace("##ShoppingCart##", _
GetHtmlFromControl(myGridView))
theMessage = theMessage.Replace("##OrderNumber##", orderId.ToString())
mySmtpClient.Send("info@carefreejewelry.com", emailAddress, theSubject, theMessage)
End If
To
Dim mySmtpClient As SmtpClient = New SmtpClient()
Dim myMessage As MailMessage = New MailMessage( _
AppConfiguration.EmailFrom, AppConfiguration.EmailTo, subject, _
errorMessage.ToString())
myMessage.IsBodyHtml = True
mySmtpClient.Send(myMessage)
Or did you changed something else or more?
|

November 8th, 2007, 01:45 PM
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Here is the code that I used and it works perfect. Give this a try and let me know if it works for you.
Public Shared Sub SendConfirmationMessage( _
ByVal theShoppingCart As ShoppingCart, ByVal orderId As Integer, _
ByVal emailAddress As String)
Try
Dim myGridView As GridView = CreateGridView()
myGridView.DataSource = theShoppingCart.Items
myGridView.DataBind()
If myGridView.Rows.Count > 0 Then
myGridView.FooterRow.Cells(0).Text = "Totals:"
myGridView.FooterRow.Cells(3).Text = _
String.Format("{0:c}", theShoppingCart.Total)
Dim theSubject As String = "Your order at Carefree Jewelry"
Dim theMessage As String = My.Computer.FileSystem.ReadAllText _
(AppConfiguration.ConfirmationMessageLocation)
Dim mySmtpClient As New System.Net.Mail.SmtpClient
theMessage = theMessage.Replace("##ShoppingCart##", _
GetHtmlFromControl(myGridView))
theMessage = theMessage.Replace("##OrderNumber##", orderId.ToString())
Dim myMessage As MailMessage = New MailMessage("info@mydomain.com", emailAddress, theSubject, theMessage)
myMessage.IsBodyHtml = True
mySmtpClient.Send(myMessage)
End If
|

November 9th, 2007, 03:53 AM
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks man that was it, it now works really great also my cc function now works :D
I Really love these forums.
|
|
 |