trimmed string after replace function
trimmed string after replace function
am 15.01.2007 22:15:50 von denoxis
Hi,
I have a mystery to solve. It is a mystery because it happens randomly.
In the ASP page that is in question, I build a large string (no more
than 10K) which is basically an email template in HTML format. Then I
replace the parts with the values, which are also strings with the size
of 1-2 KB.
For example:
order_summary = generateOrderSummary() 'This HTML string is no more
than 4-5 KB
send_email (order_summary, to_sales_department) 'This email goes to
sales dept, they receive it OK.
email_body = readFromFile("HTML_email_template.html") ' This is 10KB
email_body = replace (email_body, "", billing_name)
email_body = replace (email_body, "",
order_summary)
email_body = replace (email_body, "", other_stuff)
send_email (email_body, to_customer) ' They sometimes receive trimmed
order summary.
Here is the mystery: sometimes recipients complain that their order
confirmation is wrong because it seems order_summary part is trimmed.
They fw me the email and yes it was trimmed, however the rest of the
email is OK: just the order_summary in the middle of the email was
messed up. Since order_summary shows OK on the first email, and not on
the second email I concluded that there must be something with the
replace function. It doesn't happen a lot, there are only 2 known cases
out of couple thousands. It is not order-specific either, I place the
same order and order_summary shows OK.
Any suggestions on how to isolate the problem?
Have you encountered the same/similar problems with strings?
I use ASP 3.0 on IIS 6.0. Server is Windows 2003.
Thanks
Deniz
Re: trimmed string after replace function
am 15.01.2007 23:34:23 von Anthony Jones
"denoxis" wrote in message
news:1168895750.612689.65230@s34g2000cwa.googlegroups.com...
> Hi,
>
> I have a mystery to solve. It is a mystery because it happens randomly.
>
>
> In the ASP page that is in question, I build a large string (no more
> than 10K) which is basically an email template in HTML format. Then I
> replace the parts with the values, which are also strings with the size
> of 1-2 KB.
>
> For example:
>
> order_summary = generateOrderSummary() 'This HTML string is no more
> than 4-5 KB
>
> send_email (order_summary, to_sales_department) 'This email goes to
> sales dept, they receive it OK.
>
> email_body = readFromFile("HTML_email_template.html") ' This is 10KB
>
> email_body = replace (email_body, "", billing_name)
>
> email_body = replace (email_body, "",
> order_summary)
>
> email_body = replace (email_body, "", other_stuff)
>
> send_email (email_body, to_customer) ' They sometimes receive trimmed
> order summary.
>
>
>
> Here is the mystery: sometimes recipients complain that their order
> confirmation is wrong because it seems order_summary part is trimmed.
> They fw me the email and yes it was trimmed, however the rest of the
> email is OK: just the order_summary in the middle of the email was
> messed up. Since order_summary shows OK on the first email, and not on
> the second email I concluded that there must be something with the
> replace function. It doesn't happen a lot, there are only 2 known cases
> out of couple thousands. It is not order-specific either, I place the
> same order and order_summary shows OK.
>
> Any suggestions on how to isolate the problem?
> Have you encountered the same/similar problems with strings?
>
It has been known that if the html body part of the email is not encoded
using quoted-printable encoding that white space gets inserted into html tag
names. When that happens the html output gets messed up.
> I use ASP 3.0 on IIS 6.0. Server is Windows 2003.
>
> Thanks
>
> Deniz
>
Re: trimmed string after replace function
am 16.01.2007 16:29:45 von Dave Anderson
denoxis wrote:
> Any suggestions on how to isolate the problem?
> Have you encountered the same/similar problems with strings?
What happens when you change this...
> email_body = replace (email_body, "",
> order_summary)
....to this?
email_body = replace(email_body, "",
Server.HTMLEncode(order_summary))
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Re: trimmed string after replace function
am 16.01.2007 22:11:38 von denoxis
If I do that I see the HTML source in the email! Doesn't HTMLEncode
change "<" to < and ">" to > etc? I don't want that, my email
*is* in HTML, I want to keep the tags so my email would be formatted
accordingly.
Deniz
Dave Anderson wrote:
> denoxis wrote:
> > Any suggestions on how to isolate the problem?
> > Have you encountered the same/similar problems with strings?
>
> What happens when you change this...
>
> > email_body = replace (email_body, "",
> > order_summary)
>
> ...to this?
>
> email_body = replace(email_body, "",
> Server.HTMLEncode(order_summary))
>
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message. Use
> of this email address implies consent to these terms.
Re: trimmed string after replace function
am 17.01.2007 14:53:21 von Dave Anderson
denoxis wrote:
>> email_body = replace(email_body, "",
>> Server.HTMLEncode(order_summary))
>
> If I do that I see the HTML source in the email! Doesn't HTMLEncode
> change "<" to < and ">" to > etc? I don't want that, my email
> *is* in HTML, I want to keep the tags so my email would be formatted
> accordingly.
Right. But you did not try, so you did not find out if your content is
actually present.
I made the suggestion so you could determine whether you were simply guilty
of writing sloppy HTML in the affected section. NOT VISIBLE does not equal
NOT THERE when it comes to HTML, after all. I suppose you can still [view
source] on the offending messages if you want to know for sure.
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Re: trimmed string after replace function
am 19.01.2007 00:42:33 von denoxis
Dave Anderson wrote:
> denoxis wrote:
> >> email_body = replace(email_body, "",
> >> Server.HTMLEncode(order_summary))
> >
> > If I do that I see the HTML source in the email! Doesn't HTMLEncode
> > change "<" to < and ">" to > etc? I don't want that, my email
> > *is* in HTML, I want to keep the tags so my email would be formatted
> > accordingly.
>
> Right. But you did not try, so you did not find out if your content is
> actually present.
I appreciate the suggestion, I did try it before I post my answer and
that's what I saw: piece of HTML source code in the middle of HTML
email, which would show correctly if it was real HTML. I thought you
suggested that those codes would translate back to normal HTML in the
email.
> I made the suggestion so you could determine whether you were simply guilty
> of writing sloppy HTML in the affected section. NOT VISIBLE does not equal
> NOT THERE when it comes to HTML, after all. I suppose you can still [view
> source] on the offending messages if you want to know for sure.
Sloppy HTML is less likely since it is generated in a loop for each
product. Something like:
....
"
" & product_name & " | " & price & " | " & qty &
" |
"
....
I did make sure product names don't contain weird characters (such as <
and >) By looking at the source code of the email that is in question,
I see part of the HTML is missing with no trace
I did however one thing: adding linebreaks in the HTML-generating loop
(otherwise there could be a very long line depending on the order size,
which is actually reason of some of the bounce-backs) So maybe it is
line-length related issue. We will see if adding '& vbcrlf' to the end
of the code above helps.
Thanks for the answers
Deniz
>
>
>
> --
> Dave Anderson
>
> Unsolicited commercial email will be read at a cost of $500 per message. Use
> of this email address implies consent to these terms.
Re: trimmed string after replace function
am 19.01.2007 09:11:23 von Anthony Jones
"denoxis" wrote in message
news:1169163753.243505.200230@v45g2000cwv.googlegroups.com.. .
>
> Dave Anderson wrote:
> > denoxis wrote:
> > >> email_body = replace(email_body, "",
> > >> Server.HTMLEncode(order_summary))
> > >
> > > If I do that I see the HTML source in the email! Doesn't HTMLEncode
> > > change "<" to < and ">" to > etc? I don't want that, my email
> > > *is* in HTML, I want to keep the tags so my email would be formatted
> > > accordingly.
> >
> > Right. But you did not try, so you did not find out if your content is
> > actually present.
>
> I appreciate the suggestion, I did try it before I post my answer and
> that's what I saw: piece of HTML source code in the middle of HTML
> email, which would show correctly if it was real HTML. I thought you
> suggested that those codes would translate back to normal HTML in the
> email.
>
> > I made the suggestion so you could determine whether you were simply
guilty
> > of writing sloppy HTML in the affected section. NOT VISIBLE does not
equal
> > NOT THERE when it comes to HTML, after all. I suppose you can still
[view
> > source] on the offending messages if you want to know for sure.
>
> Sloppy HTML is less likely since it is generated in a loop for each
> product. Something like:
> ...
> "" & product_name & " | " & price & " | " & qty &
> " |
"
> ...
> I did make sure product names don't contain weird characters (such as <
> and >) By looking at the source code of the email that is in question,
> I see part of the HTML is missing with no trace
>
> I did however one thing: adding linebreaks in the HTML-generating loop
> (otherwise there could be a very long line depending on the order size,
> which is actually reason of some of the bounce-backs) So maybe it is
> line-length related issue. We will see if adding '& vbcrlf' to the end
> of the code above helps.
>
Have you yet confirmed whether the HTML body part is being encoded as
quoted-printable. I said this already but you didn't respond. If you
haven't you could well save yourself a lot of time but just checking. It is
the most likely cause of your problem.
Re: trimmed string after replace function
am 23.01.2007 23:18:37 von denoxis
Anthony,
I am sorry, I didn't read the answer carefully, I thought you were
suggesting the same thing. Actually you may be pointing out to the core
of the problem. I thought these kind of encodings were done
automatically by the email sender component, however I just checked the
reference for it and it says I have to set ContentTransferEncoding
property to "quoted-printable" to have quoted-printable. So I will
definitely try that.
Thanks for the followup!!!
Deniz
Anthony Jones wrote:
>
> Have you yet confirmed whether the HTML body part is being encoded as
> quoted-printable. I said this already but you didn't respond. If you
> haven't you could well save yourself a lot of time but just checking. It is
> the most likely cause of your problem.