ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 16th, 2004, 05:33 AM
SMC-Web SMC-Web is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 SMC-Web User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Text Wrapping in HTML Email

Hi,

First of all, I have created the email script from scratch and I am currently using CDONTS to send the email via an ASP page.

I have several textarea's that are filled in by the Administrator of the site with the relevant information. Although not all textareas have to have date entered into them.

The problem I am receiving is that when the email is received by the user, the text is not wrapped, it all appears on one line.

I have all of the data displayed in a TABLE which has a set width of 600 pixels, although this does not seem to stop the text scrolling to the right.

Can anyone offer a work around for wrapping the text in the email that is received?

Let me know if you need to see my code, or a preview of the email.

Thanks,
Steve

Reply With Quote
  #2  
Old March 16th, 2004, 05:44 AM
SevenTh SevenTh is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Netherlands
Posts: 262 SevenTh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 5 sec
Reputation Power: 5
The form discards layout, what u need to do is manually put the html codes back into the original message, use this for line breaks:

Code:
dim StrMessage
StrMessage=request.form("message")

Replace(StrMessage,chr(13),"<br>")


chr(13) is the 'enter'-char
This should do the trick,
gr,
- SevenTh

Reply With Quote
  #3  
Old March 16th, 2004, 05:53 AM
SMC-Web SMC-Web is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 SMC-Web User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have already added the following code to replace both line breaks and spaces:
Code:
strBlah = Request.Form("txtBlah")
strBlah = Replace(strBlah, vbCrLf, "<br>")
strBlah = Replace(strBlah, " ", "&nbsp;")


This code however, does not wrap the text in the 600pixel wide table.

The text takes control, and scrolls right.

Is there anyway that I can set a mamimum character width using the Replace method?

Thanks,
Steve

Reply With Quote
  #4  
Old March 16th, 2004, 07:08 AM
SevenTh SevenTh is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Netherlands
Posts: 262 SevenTh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 5 sec
Reputation Power: 5
So far so good, but u need to said it yourself, make SURE your table width is in pixels, not percentages.
Next, you should make sure that the first colum of your table (all td's) has the sum of width equal to what you've specified in your table tag, eg:

Code:
<table width="600px" border="0" cellspacing="0" cellpadding="0">
   <tr>
      <td width="100px"></td>
      <td width="400px"></td>
      <td width="100px"></td>
   </tr>
   <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
   </tr>
   <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
   </tr>
</table>


this worked for me, hope it does for you too, otherwise plz let me know

Reply With Quote
  #5  
Old March 16th, 2004, 10:56 PM
SMC-Web SMC-Web is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 SMC-Web User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Specifiying the width in the <TD> cells is not working.

I have the WRAP set to VIRTUAL if that makes and difference?

Here is the ASP Code that I am using:

Code:
<%
 'Dimension Variables
 Dim objMail
 Dim strTo
 Dim strFrom
 Dim strSubject
 Dim strMailBody
 Dim strMonth
 Dim strForthEvent
 Dim strPrevEvent
 Dim strCompetition
 Dim strOtherNews
 
 Set objMail = Server.CreateObject("CDONTS.NewMail") 'Create The CDONTS Mail Object
 
 strTo = "<VALUE REMOVED>"
 strFrom = "<VALUE REMOVED>"
 strMonth = Request.Form("sltMonth")
 strSubject = "MadCat Promotions Members "& strMonth & " Newsletter"
 
 strForthEvent = Request.Form("txtForth")
 strForthEvent = Replace(strForthEvent, vbCrLf, "<br>")
 strForthEvent = Replace(strForthEvent, " ", "&nbsp;")
 
 if strForthEvent = " " 
 then strForthEvent = "Sorry, No Information Available!" 
 else strForthEvent = strForthEvent
 end if
 
 strPrevEvent =  Request.Form("txtPrev")
 strPrevEvent = Replace(strPrevEvent, vbCrLf, "<br>")
 strPrevEvent = Replace(strPrevEvent, " ", "&nbsp;")
 
 if strPrevEvent = " " 
 then strPrevEvent = "Sorry, No Information Available!"
 else strPrevEvent = strPrevEvent
 end if
 
 strCompetition = Request.Form("txtCompetition")
 strCompetition = Replace(strCompetition, vbCrlF, "<br>")
 strCompetition = Replace(strCompetition, " ", "&nbsp;")
 
 if strCompetition = " " 
 then strCompetition = "Sorry, No Information Available!"
 else strCompetition = strCompetition
 end if
 
 strOtherNews = Request.Form("txtOtherNews")
 strOtherNews = Replace(strOtherNews, vbCrLF, "<br>")
 strOtherNews = Replace(strOtherNews, " ", "&nbsp;")
 
 if strOtherNews = " " 
 then strOtherNews = "Sorry, No Information Available!"
 else strOtherNews = strOtherNews
 end if
 
 strMailBody = strMailBody & "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.01 Transitional//EN"">"
 strMailBody = strMailBody & "<html>"
 strMailBody = strMailBody & "<head>"
 strMailBody = strMailBody & "<title>MadCat Promotions Members Newsletter</title>"
 strMailBody = strMailBody & "<meta http-equiv=""Content-Type"" content=""text/html; charset=iso-8859-1"">"
 strMailBody = strMailBody & "<meta http-equiv=""imagetoolbar"" content=""no"">"
 strMailBody = strMailBody & "<link href=""<VALUE REMOVED>"" rel=""stylesheet"" type=""text/css"">"
 strMailBody = strMailBody & "</head>"
 strMailBody = strMailBody & "<body bgcolor=""#333333"" text=""#FFFFFF"">"
 strMailBody = strMailBody & "<table width=""400px"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"" bgcolor=""#333333"" id=""MadCat-Members"">"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px"">"
 strMailBody = strMailBody & "<img src=""<VALUE REMOVED>"" width=""378"" height=""80"">"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px"">"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial"">&nbsp;</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""666666"" width=""400px"">"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial"">"
 strMailBody = strMailBody & "<b>MadCat Promotions " & strMonth & " Members Email</b>"
 strMailBody = strMailBody & "</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px"">"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial"">&nbsp;</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#666666"" width=""400px"">"
 strMailBody = strMailBody & "<center>"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial""><b>MadCat Promotions Forthcoming Event News</b></font>"
 strMailBody = strMailBody & "</center>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#999999"" width=""400px"">"
 strMailBody = strMailBody & "<font color=""#000000"" size=""2"" face=""Arial>" & strForthEvent & "</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px"">"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial"">&nbsp;</font></td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#666666"" width=""400px"">"
 strMailBody = strMailBody & "<center><font size=""2"" face=""Arial""><b>MadCat Promotions Previous Event News</b></font></center>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#999999"" width=""400px"">"
 strMailBody = strMailBody & "<font color=""#000000"" size=""2"" face=""Arial"">" & strPrevEvent & "</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px"">"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial"">&nbsp;</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#666666"" width=""400px"">"
 strMailBody = strMailBody & "<center><font size=""2"" face=""Arial""><b>MadCat Promotions Competition News</b></font></center>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#999999"" width=""400px"">"
 strMailBody = strMailBody & "<font color=""#000000"" size=""2"" face=""Arial"">" & strCompetition & "</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px"">"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial"">&nbsp;</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#666666"" width=""400px"">"
 strMailBody = strMailBody & "<center><font size=""2"" face=""Arial""><b>Other MadCat Promotions News</b></font></center>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#999999"" width=""400px"">"
 strMailBody = strMailBody & "<font color=""#000000"" size=""2"" face=""Arial"">" & strOtherNews & "</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px"">"
 strMailBody = strMailBody & "<font size=""2"" face=""Arial"">&nbsp;</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#666666"" width=""400px"">"
 strMailBody = strMailBody & "<center><font size=""2"" face=""Arial""><b>MadCat Promotions Useful Links</b></font></center>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td bgcolor=""#999999"" width=""400px"">"
 strMailBody = strMailBody & "<font color=""#000000"" size=""2"" face=""Arial"">"
 strMailBody = strMailBody & "Website Address: <a href=""<VALUE REMOVED>"" target=""_blank""><VALUE REMOVED></a><br>"
 strMailBody = strMailBody & "Members List: <a href=""<VALUE REMOVED>"" target=""_blank""><VALUE REMOVED></a><br>"
 strMailBody = strMailBody & "Event Feedback: <a href=""<VALUE REMOVED>"" target=""_blank""><VALUE REMOVED></a><br>"
 strMailBody = strMailBody & "Event Galleries: <a href=""<VALUE REMOVED>"" target=""_blank""><VALUE REMOVED></a><br>"
 strMailBody = strMailBody & "Forum: <a href=""<VALUE REMOVED>"" target=""_blank""><VALUE REMOVED></a></font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px""><font size=""2"" face=""Arial"">&nbsp;</font></td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "<tr> "
 strMailBody = strMailBody & "<td width=""400px""><font color=""#FFFFFF"" size=""2"" face=""Arial"">Yours,<br>"
 strMailBody = strMailBody & "The Administrative Team</font>"
 strMailBody = strMailBody & "</td>"
 strMailBody = strMailBody & "</tr>"
 strMailBody = strMailBody & "</table>"
 strMailBody = strMailBody & "</body>"
 strMailBody = strMailBody & "</html>"
 
  objMail.BodyFormat = 0  '1 = Plain Text, 0 = HTML Format
 
  objMail.MailFormat = 0  '1 = Plain Text, 0 = MIME Format
 
 objMail.To = strTo
 objMail.From = strFrom
 objMail.Value("Reply-To") = "<VALUE REMOVED>" 
 objMail.Subject = strSubject
 objMail.Body = strMailBody
 
 objMail.Send
 
 Set objMail = nothing
%>


Is there anything wrong with the above code? Or any little snippents that can be added to aid with the text wrapping problem?

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingASP Development > Text Wrapping in HTML Email


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT