PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
What Am I Missing - Using Windows Web & Linux SMTP Serve

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
djbranson



Joined: 29 Oct 2006
Posts: 2
Location: Lubbock, Texas

PostPosted: Wed Nov 01, 2006 6:28 am    Post subject: What Am I Missing - Using Windows Web & Linux SMTP Serve Reply with quote

I have a client-side html form calling a php script in that same directory, which is supposed to send an SMTP-authenticated email message. The php has:

<?php
require_once "Mail.php";

$first_name = $_REQUEST['first_name'];
$last_name = $_REQUEST['last_name'];
$email = $_REQUEST['email'];
$zip_code = $_REQUEST['zip_code'];

$from = $email;
$to = "me@mydomain.com";
$subject = "My Test Email";
$body = $first_name . " " . $last_name . "\n" . $email . "\n" . $zip_code;

$host = "mail.mysmtphost.com";
$username = "myusername";
$password = "mypassword";

$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! Press 'Back'</p>");
}
?>

When my html form gets the data and calls the php script, I get the following messages:

Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in C:\...\m_request.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.;C:\php5\pear') in C:\...\m_request.php on line 2

Any suggestions you might have would be appreciated.

*** Added Note: I tried the form & php script using the simple Mail() function and it worked perfectly with my Linux Mail Server from my Windows XP-based development computer WITHOUT SMTP, but when I moved the webpage and script over to my Windows 2000 Web Server, I got the message that SMTP was required to work with that same Linux Mail Server... that is a bit confusing to me.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software