PEAR fejl ved afsendelse af mail
HejsaJeg har endelig fået mail funktionen til TDC til at virke ved at bruge PEAR.
Jeg bruger et PHP script som ser sådan ud:
<?php
require_once "Mail.php";
$from = "Flemming Test2 <min_mail@mail.tele.dk>";
$to = "test_konto Recipient <test_konto@hotmail.com>";
$subject = "SMTP test";
$body = "Hi,\n\nHow are you?";
$host = "asmtp.mail.dk";
$username = "min_mail@mail.tele.dk";
$password = "mit_password";
$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 {
echo("<p>Message successfully sent!</p>");
}
?>
Og det virker..... MEN jeg får også følgende fejl.
Strict Standards: Non-static method Mail::factory() should not be called statically in C:\Lemche Webdesign\www\php\Mailer2.php on line 20
Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\Program Files\PHP\PEAR\pear\Mail\smtp.php on line 365
Strict Standards: Non-static method Mail_RFC822::parseAddressList() should not be called statically, assuming $this from incompatible context in C:\Program Files\PHP\PEAR\pear\Mail.php on line 253
Strict Standards: Non-static method PEAR::isError() should not be called statically in C:\Lemche Webdesign\www\php\Mailer2.php on line 24
Message successfully sent!
Hvad er der galt og hvorfor kommer de???
/Lemche