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>'; Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/ Share on other sites More sharing options...
Rohan Shenoy Posted May 6, 2008 Share Posted May 6, 2008 Try using double quotes. Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534449 Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 Where? Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534451 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? Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534456 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 Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534462 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"; Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534464 Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 i tried that still same issue ??? Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534468 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 Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534477 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 ? Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534483 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. Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534484 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 = "[email protected]"; $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 ? Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534488 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> Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534491 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??? Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534513 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="[email protected]"; //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 <[email protected]>'; $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 Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534521 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? Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534655 Share on other sites More sharing options...
perezf Posted May 6, 2008 Author Share Posted May 6, 2008 Doesnt work on any server... Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534682 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. Link to comment https://forums.phpfreaks.com/topic/104394-php-basic-email-problem-help-please/#findComment-534755 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.