perezf Posted May 6, 2008 Share Posted May 6, 2008 For some reason when i submit from my form, all the code is displayed in the email itself??? Meaning all of the html, i dont understand why its happening? ??? $from = $_POST['fromemail']; $htmlstart = "From: $from\r\n"; $htmlstart .= "MIME-Version: 1.0\r\n"; $htmlstart .= "Content-type: text/html; charset=iso-8859-1\r\n"; mail($_POST['toemail'], $_POST['subject'], $_POST['message'], $htmlstart); print '<p>Successfully sent to ' . $_POST['toemail'] . '</p>'; Quote Link to comment Share on other sites More sharing options...
Rohan Shenoy Posted May 6, 2008 Share Posted May 6, 2008 Try using double quotes. Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 Where? Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted May 6, 2008 Share Posted May 6, 2008 hmmm what is inside the $message variables? btw wat do u mean by all the code is displayed inside the email? do you mean the html code is shown in the email? Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 Content-type: text/html; charset=iso-8859-1 Â Â <p><strong>just a test</strong></p> Â This is what comes in the email Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted May 6, 2008 Share Posted May 6, 2008 try rearranging this bit... $htmlstart = "From: $from\r\n"; $htmlstart .= "MIME-Version: 1.0\r\n"; $htmlstart .= "Content-type: text/html; charset=iso-8859-1\r\n"; to $htmlstart = "MIME-Version:1.0 \r\n"; $htmlstart .= "Content-type: text/html; charset=iso-8859-1 \r\n"; $htmlstart .= "From: $from"; Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 i tried that still same issue ??? Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 Is there maybe a different way i could set this up? using php Quote Link to comment Share on other sites More sharing options...
ady01 Posted May 6, 2008 Share Posted May 6, 2008 Are you trying to send mail from a hosted server or is it your own ? Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 This is my own server, well actually its for a company i work for and im working on the email script for a client? but im stumped. But yes this is our server. Quote Link to comment Share on other sites More sharing options...
ady01 Posted May 6, 2008 Share Posted May 6, 2008 Well assuming your server is set up right i would maybe try something like :  <?php $to = "example@example.com"; $subject = "Hello"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) {  echo("<p>Message successfully sent!</p>"); } else {  echo("<p>Message delivery failed...</p>"); } ?>    Is this what you mean ? Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 yes, but i mean setting it up so i can send html emails. Because what i have now is not sending graphic emails, all it sends is the html code to me instead. For example: Content-type: text/html; charset=iso-8859-1   <p><strong>just a test</strong></p> Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 does anybody have any idea on why this is happening??? Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted May 6, 2008 Share Posted May 6, 2008 hmmm make a new page and chek if this bit of code works on your server. Also change appropriately... Â $email="noobs@noobs.com"; //who to email to $headers="MIME-Version:1.0 \r\n"; $headers .= "Content-type: text/html;charset=iso-8859-1 \r\n"; $headers .= 'From: Name <support@name.com>'; $subject = "User [New Account]"; $msg = " <center>hello</center><br /> <b>i</b><u> am personally</u> proud of <i>myself</i> "; mail($email, $subject, $msg, $headers); Â if that doesnt work then there may be a server issue Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 Still doesnt seem to work, and what kind of server issue could it be if that is the fact? Quote Link to comment Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 Doesnt work on any server... Quote Link to comment Share on other sites More sharing options...
jonsjava Posted May 6, 2008 Share Posted May 6, 2008 get HTML Mime Mail. That site also has articles on how to use it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.