Jump to content

Little Question About Email Script..


norNerd

Recommended Posts

Hi people, I have to use smtp connection insted of the regular mail(); function..Runned over a script wich uses the pear mail package included in php 4 or later. Here is the script:

<?phprequire_once "Mail.php"; //This one is my problem, i dont have a file anywhere wich is named Mail.php, should i just create one? :s$from = "Sandra Sender <sender@example.com>";$to = "Ramona Recipient <recipient@example.com>";$subject = "Hi!";$body = "Hi,\n\nHow are you?";$host = "mail.example.com";$username = "smtp_username";$password = "smtp_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>"); }?>

Got this code from:http://email.about.com/od/emailprogramming...hentication.htmRemoved require_once "Mail.php";And got fatal error, class Mail not found, so guess the file Mail.php have something to do with the missing function? :sKris

Link to comment
Share on other sites

You want to install all of Pear, the Mail package might depend on other packages. Once you install it all of the include files will be in the Pear directory and it will modify the PHP include path so that PHP always checks in that directory if it can't find the include file in another place.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...