i'm assuming setting a content type of text/html format income emails to the default font style and size of the clients/users machine. User Pear Mail how would I add in a content type. All the examples I've send only show adding content-type with mime attachments.
Also if there is another way to make and incoming email default to users mail clients font style and size, I'd like to know.
would like to add
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
current mail code
$from = "[email protected]";
$to = $SendTo;
$subject = "Contact : " . $uxGlobalLocation;
$body = $Bodycopy;
$host = "mail.set.co";
$username = "[email protected]";
$password = "empty00";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
header ('Location: /');
exit();
}
EDIT Possible answer
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'Content-Type' => 'text/html; charset=iso-8859-1',
'MIME-Version' => '1.0');
This works. It took me forever to figure out the last item in the $headers array must have \r\n\r\n
<?php
require_once "Mail.php";
$from = "Web Master <[email protected]>";
$replyto = "Education Dept. <[email protected]>";
$to = "<[email protected]>";
$subject = "Test email using PHP SMTP";
$body = "<p>Test HTML</p><p>This is a test email message</p>";
$host = "smtp.example.com";
$username = "[email protected]";
$password = "****************";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject,
'Reply-To' => $replyto,
'MIME-Version' => "1.0",
'Content-type' => "text/html; charset=iso-8859-1\r\n\r\n");
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With