Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unwanted '!' in email 1

Status
Not open for further replies.

colep

Programmer
Jul 18, 2002
58
0
0
US
I have a strange thing happening... I am pulling content from a MySQL table and inserting it into an email message and an exclamation point is appearing in the email. There isn't one in the table and there isn't one when I just display the content from the table to the page... It's the strangest thing... Has anyone come across this before??? Any hints???

Thanks in Advance,
Cole ;)
 
how about some code and sample data? what is the frequency of the error?

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
Ok, here's the code:
$sql = "SELECT * FROM events WHERE id='$_POST[event_id]'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);

$strMail = <table>
<tr>
<td>&quot;;
if ($row[title] != &quot;&quot;)
$strMail .= &quot;<div class=elevenb>$row[title]</div>&quot;;
$strMail .= &quot;$row[description]
</td>
</tr>
</table>&quot;;

And then I send it using the mail() function.

And the data that it's displaying is:
A native of England, Wright came to the United States in 1978. Prior to joining the Wolves, he spent three years working for the state of Minnesota, first as a consultant working on bids for major national and international events, including the programming for the $17.4 million National Sports Center in Blaine. Prior to that, Wright also served ! as general manager for two Major Indoor Soccer League teams, the Pittsburgh Spirit (1981-86) and the Minnesota Strikers (1986-87).

(where if you look 3 lines up from the bottom, the ! appears). It's happening only on this page... And I've never seen it before... It's the strangest thing...

Cole ;)
 
You have some strange things going on with quotes in your code. I'm frankly suprised the posted code runs at all.

Does this version of your code exhibit the same behavior?

Code:
$sql = &quot;SELECT * FROM events WHERE id='&quot; . $_POST['event_id'] . &quot;'&quot;;
$result = mysql_query($sql);
$row = mysql_fetch_array($result);

$strMail = '<table>
  <tr>
    <td>';
if ($row['title'] != '') 
	$strMail .= '<div class=&quot;elevenb&quot;>' . $row['title'] . '</div>';
$strMail .= $row['description'];
$strMail .= '</td>
  </tr>
</table>';

Want the best answers? Ask the best questions: TANSTAAFL!!
 
and what does the raw data look like?

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
The data in the DB table is:
<p>A native of England, Wright came to the United States in 1978. Prior to joining the Wolves, he spent three years working for the state of Minnesota, first as a consultant working on bids for major national and international events, including the programming for the $17.4 million National Sports Center in Blaine. Prior to that, Wright also served as general manager for two Major Indoor Soccer League teams, the Pittsburgh Spirit (1981-86) and the Minnesota Strikers (1986-87).<BR>

So as you can see there isn't a '!' anywhere in the raw data... I just don't get it...

Cole ;)
 
Some versions of Sendmail will cut long lines (above 1000 bytes I believe) and add a '!' where it cuts the line.

The solution is to make shorter lines (wordwrap() could help here) or encode the text in quoted-printable (which does make sure the lines are short enough to cause no problems with mail servers)
 
Thanks for the help pfournier!!! That was the problem... I just broke up the description part of it, and it no longer displays the '!'

Thanks Again,
Cole ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top