<?php
@require_once"Mail.php";
$from="from email"; //enter email of sender
$to="recepient email"; //enter to email
$subject="subject";
$body="content";
$host="ssl://smtp.gmail.com";
$port="465";
$username="your gmail account user name";
$pwd="your gmail account password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$headers["Content-Type"] = 'text/html; charset=UTF-8';
$smtp = @Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $pwd));
//Send Email using pear sned option
$mail = @$smtp->send($to, $headers, $body);
//If any errors occurs
if (@PEAR::isError($mail)) {
("<p>" . $mail->getMessage() . "</p>");
}
else {
echo("<p>Message successfully sent!</p>");
}
?>
Adding @ reduce some error but still have three errors are coming they are:
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 491
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 265
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 267