E-mail attachment and Exclamation point

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Frederick
Forum Newbie
Posts: 13
Joined: Fri Nov 15, 2002 9:42 am

E-mail attachment and Exclamation point

Post by Frederick »

I have a php program that reads data from a post. It takes the data, puts it into a file and mails it to me as an HTML attachment. For some reason, I get random exclamation points in different spots. It's not many, maybe 3 or 4 but I cant find a pattern. Here's what Im using:

Code: Select all

################

$mime_boundary = "<<<--==+X&#1111;".md5(time())."]";

$headers .= "From: Web Site <fddd@ddd.com>\r\n"; 
$headers .= "To: ddd<fdddd@dd.com>\r\n"; 

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/mixed;\r\n";
$headers .= " boundary="".$mime_boundary.""";

$message .= "This is a multi-part message in MIME format.\r\n";
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";

$fp = fopen ($member, "r");
$file = fread($fp, filesize($member));
$filename = basename($member);

$message .= "Content-Type: text/plain; charset="iso-8859-1"\r\n";
$message .= "Content-Transfer-Encoding: 7bit\r\n";
$message .= "\r\n";
$message .= "$username needs to be updated.\r\n";
$message .= "--".$mime_boundary."\r\n";

$message .= "Content-Type: text/plain;"\r\n";
##$message .= "Content-Type: application/octet-stream;\r\n";
$message .= " name="$username.htm"\r\n";
$message .= "Content-Transfer-Encoding: quoted-printable\r\n";
$message .= "Content-Disposition: attachment;\r\n";
$message .= " filename="filename.extn"\r\n";
$message .= "\r\n";
$message .= "<html>" .$file;
$message .= "\r\n";
$message .= "--".$mime_boundary."\r\n";



$ok = mail("me@me.com", "Change Request", $message, $headers);



###############
Any ideas why Im getting "!" randomly?

thanks!
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Do the exclamation marks occur in the same place each time when the same data is inputted? maybe you could show us and example of the attachment that includes the exclamation marks.

Mark
Frederick
Forum Newbie
Posts: 13
Joined: Fri Nov 15, 2002 9:42 am

Post by Frederick »

That's what was so weird Bech100, and made it hard to spot.

Here's the fix from the PHP manual.


If you get an unexplainable exclamation mark (!) appearing
in the mail that you send using mail(),you are probally
sending a message wich has no newline characters (\n)

Fix this in your script or use this

$msg = wordwrap($msg, 72);

This will make sure that there are no excessively long
lines in your message, and thus remove that exclamation mark from your message.
Post Reply