Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Mail::factory


Bighawk

Recommended Posts

Posted

I set up a page called emailtest.php using the code in the quote below.

 

Create the following PHP file, and save it as mailfactory_test.php

 

<?
include("Mail.php");

$user_contact = '[email protected]';
$to_addr = '[email protected]';
$subject = 'Mail factory test';
$email_body 'This is just a test to see if the mail::factory method works';

$headers["From"]	= $user_contact;
$headers["To"]	  = $to_addr;
$headers["Subject"] = $subject;

$params["host"] = "localhost.yoursite.com";
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = "user";
$params["password"] = "password";

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", $params);
return $mail_object->send($to_addr, $headers, $email_body);

//return $mail_object->send($to_addr, $headers, $this->output);
?>

 

The run mailfactory_test.php from your website.

 

You will need to define the host, username, password, and have valid email 'from' and 'to' addresses. :D

 

Peter

 

 

 

I did this and access the page with the following result:

 

Warning: main(Mail.php): failed to open stream: No such file or directory in D:\home\aaa\bighawk.net\emailtest.php on line 3

 

Warning: main(Mail.php): failed to open stream: No such file or directory in D:\home\aaa\bighawk.net\emailtest.php on line 3

 

Warning: main(): Failed opening 'Mail.php' for inclusion (include_path='.;c:\php4\pear') in D:\home\aaa\bighawk.net\emailtest.php on line 3

 

Fatal error: Undefined class name 'mail' in D:\home\aaa\bighawk.net\emailtest.php on line 21

 

 

I am not certain how to determine if pear or Mail::factory is actually active on my server. In /catalog/admin/server_info.php the only reference I see to pear is the include_path which is as follows: .;g:\php\pear

Does this mean it is activated? If not how can I determine if it is active?

 

Do I need to set a path on line 3 from this

include("Mail.php");

 

to what?

Archived

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

×
×
  • Create New...