Jump to content

mail header


abs0lut

Recommended Posts

whats the difference between this

<?php 
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; multipart/alternative;\r\n";
$headers .= "From: [email protected] \r\n";
$to = "[email protected]";
$subject = "Re: your first email";
$body = "Congrats on your first email.";
$sentok = mail($to, $subject, $body, $headers);
if($sentok){ 
  echo "Mail sent. ";
} else { 
     echo "Mail not sent. ";
  }?>

with this

<?php $headers = "From: [email protected] \r\n";
$to = "[email protected]";
$subject = "Re: your first email";
$body = "Congrats on your first email.";
$sentok = mail($to, $subject, $body, $headers);
if($sentok){ 
  echo "Mail sent. ";
} else { 
     echo "Mail not sent. ";
  }
?>

 

?

Link to comment
https://forums.phpfreaks.com/topic/128078-mail-header/
Share on other sites

did you mean what do these two lines mean?

 

$headers  = "MIME-Version: 1.0\r\n";

$headers .= "Content-type: text/plain; multipart/alternative;\r\n";

 

They are setting the Type of the email. in this case text/plain.

 

if you wanted to send an html email you could set that here.

Link to comment
https://forums.phpfreaks.com/topic/128078-mail-header/#findComment-663278
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.