Richard S. Albrecht

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromRichard S. Albrecht
ToMe
SubjectmakeMIME problem, characters are being added
Date11 May 2006 22:97
Hello Mark,
 
I'm fairly new to php as I come from a Delphi background.
 
One of the projects I've had to do is take a lot of fields form formsand
build an html email for our staff to imput the information into our database
at the office.
 
The reason for HTML is it's much easier to read as I have the data in
tables.

I was lucky enough to find a copy of your makeMIME version 2.1.  Not sure
where I found it as it's been several months.

The problem I'm having is some eronious characters are beeing embedded in
the message body.

Here are a couple of examples:
1:
    <TD width=128>Youth 2 Nick Name7: </TD>&lt; <---- the "&lt;"
  <STRONG>Youth2Nick7</STRONG></TD></TR>

2:
 <TR width="128" d>Youth 1 Name: </TD>    <----- the "d" after the width

3:
    <TD width=128>NickName5: </TD>&gt;<STRONG>HawkCode5</STRONG></TD></TR>
<--- the "&gt;"


I have printed out the message body variable in the browser prior to calling
sendMIME.

Have your any idea what could cause this. 

Thanks!

--Richard S Albrecht--
FromMe
ToRichard S. Albrecht
SubjectRe: makeMIME problem, characters are being added
Date12 May 2006 09:06
Richard,

> The problem I'm having is some eronious characters are beeing embedded in
> the message body.
> Have your any idea what could cause this. 

I will need some further background details.

1. can I see the HTML file it is trying to send

2. if you know, what encoding is the HTML file saved in (I suspect 8859-1)

3. how are you attaching the HTML? is it a static file on the server? or a
web upload?

4. what version of PHP are you using?

5. are you also using my html2text library?

6. are you embedding any images or files in the body, and if so, exactly
what are you embedding

That should be enough to get on with :)


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromRichard S. Albrecht
ToMe
SubjectRe: makeMIME problem, characters are being added
Date12 May 2006 17:40
Boy thanks for the fast reply.

Using the latest PHP Ver 4, our hosting company hasn't made the switch to 5.

I have discovered something interesting.

If I set makeMIME in debug mode, and I copy the HTML string you print out
and paste it into dreamweaver everything looks fine.  

So something is corrupting it when it gets sent.

The html body is put together programatically like this:
--------------------------------

	$msg = "<BODY><table border=\"1\" cellspacing=\"2\"
cellpadding=\"2\">";
	$msg .= "<tr><td width=\"128\">NickName: </td><td><strong>";
	$msg .= $row_Recordset1['NickName'];
	$msg .= "</strong></td></tr>";

[Snip.]

	$msg .= "<tr><td width=\"128\">Suffix: </td><td><strong>";
	$msg .= $Suffix;
	$msg .= "</strong></td></tr>";
	
	$msg .= "</table>";
	$msg .= "</BODY>";
----------------------------------------------------------------------------
At end of message is the complete past of your debug output.  It is a rather
lengtly email.
The $msg is passed in the $mailHTML parameter.

All the data comes from MySQL.


If I set makeMIME in debug mode, and I copy the HTML string you print out
and paste it into dreamweaver everything looks fine.  

So it seems something is corrupting it when it gets sent.

Thanks 
--Richard S Albrecht--

Below is complete past of the $mailHTML from your
debug.-------------------------

[One giant long string of HTML]
FromMe
ToRichard S. Albrecht
SubjectRe: makeMIME problem, characters are being added
Date14 May 2006 13:24
Richard,

> If I set makeMIME in debug mode, and I copy the HTML string you print out
> and paste it into dreamweaver everything looks fine. 
> So something is corrupting it when it gets sent.

Yep, and it's not me. But something you or I are doing is confusing the PHP
'mail' function, or a server somewhere. I notice that at no point in your
code do you create any linebreaks. I do not wrap your HTML (since I do not
know where to), and I do not use quoted printable (because that requires an
extra flag when compiling PHP), so the mail is sent with that enormous long
single line in the source. Most mail systems get upset with that. I suggest
you try including a linebreak on the end of every table row, and see if that
helps. If not, try a linebreak after every </td> - keep going until every
line is less than 80 characters long in the source code. If that fails, then
I am barking up the wrong tree, but I suspect that will be it.

You can also try changing the "us-ascii" to "utf-8" in my script source (a
bad initial choice on my part), and see if that helps, although in my
testing it makes no difference for the formatted mails, but maybe it will
help your problem.

Tarquin
FromRichard S. Albrecht
ToMe
SubjectRe: makeMIME problem, characters are being added
Date15 May 2006 15:35
Thank you so very much, that appeared to be the problem.

Your help has helped me in so many ways.  

Thanks again!

--Richard S Albrecht--
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.