Hi,
I am new to php and i am trying to send an email from php code. But unfortunately i am getting some errors. Please see my below code.....
<?php
require_once "Mail.php";
$from = "ramesh sender<ramemsc@yahoo.com";
$to = "ramesh Recipient <eramesh.msc@gmail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://mail.yahoo.com";
$port = "25";
$username = "e.rameshbabu";
$password = "xxxx";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'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>");
}
?>
Please see the errors i am getting here .....
Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Mail.php on line 154
Strict Standards: Non-static method Mail::factory() should not be called statically in C:\xampp\htdocs\sendemail.php on line 22
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\smtp.php on line 225
Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\PEAR.php on line 871
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 339
Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 340
Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\PEAR.php on line 871
Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Mail\smtp.php on line 229
Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\PEAR.php on line 871
Strict Standards: Non-static method PEAR::isError() should not be called statically in C:\xampp\htdocs\sendemail.php on line 26
Failed to connect to ssl://mail.yahoo.com:25 [SMTP: Failed to connect socket: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? (code: -1, response: )]
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 364
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 196
Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\PEAR.php on line 871
Strict Standards: Non-static method PEAR::raiseError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 197
Strict Standards: Non-static method PEAR::getStaticProperty() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\PEAR.php on line 871
I would be great if anyone helps me in this case.... I will be waiting for your response.......
Thank you very much,
Ramesh

