Jump to content

PHP Basic Email Problem Help Please


perezf

Recommended Posts

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
Share on other sites

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
Share on other sites

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  ?

Link to comment
Share on other sites

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
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.