PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Fatal error: Class 'Mail' not found
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Fatal error: Class 'Mail' not found

Réponse
 
LinkBack Outils de la discussion
Vieux 28/03/2008, 08h39   #1
youu917@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Fatal error: Class 'Mail' not found

<?php
require_once "Mail.php";

$from = "Sandra Sender <technical@addplus>";
$to = "Ramona Recipient <technical@addplus.biz>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.addplus.biz";
$username = "technical@addplus.biz";
$password = "aptech";

$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>");
}
?>

i downloaded the code above from internet and i'd tried it in my
computer. However, i get the error message "Fatal error: Class 'Mail'
not found in C:\AppServ\www\seeyouu\mail.php on line 16".
Can anyone me to solve this problem? i'm new to php, i totally
don't know what happen with this.
Thank you very much
  Réponse avec citation
Vieux 28/03/2008, 09h32   #2
Erwin Moller
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Fatal error: Class 'Mail' not found

youu917@gmail.com schreef:
> <?php
> require_once "Mail.php";
>
> $from = "Sandra Sender <technical@addplus>";
> $to = "Ramona Recipient <technical@addplus.biz>";
> $subject = "Hi!";
> $body = "Hi,\n\nHow are you?";
>
> $host = "mail.addplus.biz";
> $username = "technical@addplus.biz";
> $password = "aptech";
>
> $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>");
> }
> ?>
>
> i downloaded the code above from internet and i'd tried it in my
> computer. However, i get the error message "Fatal error: Class 'Mail'
> not found in C:\AppServ\www\seeyouu\mail.php on line 16".
> Can anyone me to solve this problem? i'm new to php, i totally
> don't know what happen with this.
> Thank you very much


Erm, if you are totally new to PHP, why do you download scripts from the
net and try to use them?
Sounds to me like: "My moonrocket won't fly! Please , I am totally
new to rocketscience!"
Wouldn't it make more sense to learn some PHP basics first?

Anyway, you error means what it says: You are using a class in your code
that doesn't exist in your script.

Also, what is line 16? Is that the line that starts with:
$smtp = Mail::factory('smtp', ??

You started your script with:
require_once "Mail.php";

That require_once() means that your script will halt and produce a Fatal
error if it cannot find Mail.php. So you did offer Mail.php at least.

The class you are using is from the PEAR packages, I expect you didn't
use PEAR right.
You can find more information here:
http://pear.php.net/
but it might be hard to understand if you are totally new to PHP.
Sorry. :-/

Regards,
Erwin Moller
  Réponse avec citation
Vieux 31/03/2008, 03h05   #3
youu917@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Fatal error: Class 'Mail' not found

On Mar 28, 4:32pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...@spam yourself.com> wrote:
> youu...@gmail.com schreef:
>
>
>
>
>
> > <?php
> > require_once "Mail.php";

>
> > $from = "Sandra Sender <technical@addplus>";
> > $to = "Ramona Recipient <techni...@addplus.biz>";
> > $subject = "Hi!";
> > $body = "Hi,\n\nHow are you?";

>
> > $host = "mail.addplus.biz";
> > $username = "techni...@addplus.biz";
> > $password = "aptech";

>
> > $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>");
> > }
> > ?>

>
> > i downloaded the code above from internet and i'd tried it in my
> > computer. However, i get the error message "Fatal error: Class 'Mail'
> > not found in C:\AppServ\www\seeyouu\mail.php on line 16".
> > Can anyone me to solve this problem? i'm new to php, i totally
> > don't know what happen with this.
> > Thank you very much

>
> Erm, if you are totally new to PHP, why do you download scripts from the
> net and try to use them?
> Sounds to me like: "My moonrocket won't fly! Please , I am totally
> new to rocketscience!"
> Wouldn't it make more sense to learn some PHP basics first?
>
> Anyway, you error means what it says: You are using a class in your code
> that doesn't exist in your script.
>
> Also, what is line 16? Is that the line that starts with:
> $smtp = Mail::factory('smtp', ??
>
> You started your script with:
> require_once "Mail.php";
>
> That require_once() means that your script will halt and produce a Fatal
> error if it cannot find Mail.php. So you did offer Mail.php at least.
>
> The class you are using is from the PEAR packages, I expect you didn't
> use PEAR right.
> You can find more information here:http://pear.php.net/
> but it might be hard to understand if you are totally new to PHP.
> Sorry. :-/
>
> Regards,
> Erwin Moller- Hide quoted text -
>
> - Show quoted text -


thank you
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h01.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12542 seconds with 11 queries