Issues in sending Mail via PHP
Posted: Wed Jul 25, 2007 5:07 am
Code: Select all
<?php
require "Mail.php";
$from = "<admin@something.com>";
$to = "<mail@something.com>";
$subject = "Test Mail";
$body = "Hi,\n\nHow are you?";
$host = "mail.something.com";
//$username = "";
//$password = "";
$headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject);
$smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => false, '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>");
}
?>1) Only plain text can be sent in the body of the email while i want to send the html content.
2) The mail is sent only to a particular domain mail.something.com. Using this script i am unable to sent any emails to yahoo, gmail or for that matter rediffmail.
I would want to send the mail to all the clients i.e, gmail, yahoo, rediffmail, something.com etc...
How do i do it?
Regards,
Dream2rule