FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


wierd php problem with sendmail





ammonkc
I made a simple script for sending emails through a web page using sendmail. everything works fine but when I get the emails there are "!" (exclamation points) inserted in the text in random places. The mime type is html.

This is the function that creates and sends the email:
Code:

<?php
function email($user_email,$message,$subject,$send,$whatform) {
   
   $from = "Agent-Updates@pantours.net";
   $msg_body = '<html><body>';

   $message = stripslashes($message);    //strip slashes because of magic quotes
   $headers = "From: $from\n";
   $headers .= "Content-type: text/html; charset=iso-8859-1";
   $msg_body .= '<div style="width:500px; padding:15px; font-size:14px;">';
   $msg_body .= "<p>".$message."</p>";
   $msg_body .= '<p>If you no longer wish to receive emails from Pan Tours Hawaii, please click here</p>';
   $msg_body .= '</div></body></html>';
   /****  send email out  ****/
   if ( $send == "yes" ) {
      $sent = mail($user_email,$subject,$msg_body,$headers);
      return $sent;
   }else{
      return $msg_body;
   }
}//end email() function
?>
hexkid
Your function, exactly like you posted, worked as expected for me.
I only added the following two lines
Code:
email('one.of.my.addresses@example.com', 'message here', 'subject', 'yes', false);
echo 'Done!';


I suspect the problem is somewhere else.
ammonkc
Yeah, It works fine on my testing server also, but on the production server I will get these wierd annomalies "!".

Quote:

Pan Tours Hawaii is happy to announce multi-island packaging, our newest enhancemen! t for online Hawaii bookings.


I'm guessing its a server setting and has something to do with the default text encoding of apache. My testing/dev server is on a mac but the production server that is giving me problems is an older Redhat linux machine.
hexkid
After a bit of search I found two posts that might be useful to you.
ammonkc
hexkid wrote:
After a bit of search I found two posts that might be useful to you.

That is the exact problem that I'm having. Aparently The users were inputing the html all in one line without breaks. Thanks!
Related topics
simple php problem, please help...
A PHP problem !
wierd Dreamweaver Problem
HTML + PHP problem
A php problem
PHP problem...
PHP Problem: Unable to execute ext. commands
PHP Problem...
[PHP] Problem with Dynamic Sig's Font Color
Form and PHP problem
PHP imagecreate + CSS problem.
PHP imagecreate + CSS problem.
Could there be a PhP problem on the server?
[help]Mysql & php problem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.