|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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, " ", " ")
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 |
|
#4
|
|||
|
|||
|
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> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
this worked for me, hope it does for you too, otherwise plz let me know |
|
#5
|
|||
|
|||
|
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, " ", " ")
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, " ", " ")
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, " ", " ")
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, " ", " ")
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""> </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""> </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""> </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""> </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""> </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""> </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""> </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? |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Text Wrapping in HTML Email |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|