I am trying to send data from a form to an email. I did the following:
- Browsed to : http://pear.php.net/package/Mail/download/1.2.0b5
- Downloaded the beta file 1.2.0b5
- Unziped the file and placed in XAMPP htdocs folder
- Created the following code:
<?php // Pear Mail Library
require_once "Mail.php";
$from = '<johannes.gmail.com>';
$to = '<[email protected]>';
$subject = 'Hi!';
$body = "Hi,\n\nHow are you?";
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $subject
);
$smtp = Mail::factory('smtp', array(
'host' => 'smtp.gmail.com',
'port' => '465',
'auth' => true,
'username' => '[email protected]',
'password' => 'bon3dfredds'
));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo('<p>' . $mail->getMessage() . '</p>');
} else {
echo('<p>Message successfully sent!</p>');
}
?>
but I get the following error:
Strict Standards: Non-static method Mail::factory() should not be called statically in C:\xampp\htdocs\Mail Tester\Untitled-1.php on line 22
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\Mail Tester\Mail\smtp.php on line 365
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::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\PEAR\Net\SMTP.php on line 344 Any help will be greatly appreciated