ChaosKnight Posted May 14, 2010 Share Posted May 14, 2010 Okay, so I discovered this part of the forum just now. I never used a library script before, but I decided to use the PEAR Mail package for the emails that are sent from my site. I tried running this code: if (isset($_POST['submit'])){ require_once "mail/Mail.php"; // Database works fine, so db code left out... if(mysql_query($sql,$db_link)){ $from = "From <address>"; $to = "To <address>"; $host = "mail domain"; $username = "username"; $password = "password"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $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, $message); if (PEAR::isError($mail)) { echo "<h3>The message was not sent...</h3>" . $mail->getMessage(); }else{ echo "<h3>The message was sent successfully...</h3>"; } } mysql_close($db_link); } ?> But then the script generates this error messages: Warning: main(PEAR.php) [function.main]: failed to create stream: No such file or directory in f:\wwwroot\<address>\mail\Mail.php on line 46 Fatal error: main() [function.main]: Failed opening required 'PEAR.php' (include_path='.;c:\php4\pear') in f:\wwwroot\<address>\mail\Mail.php on line 46 What does this mean? Is it only because pear and mail is in different folders and I didn't include the PEAR.php in the contact page? PEAR.php is at: \domain\pear\PEAR\ Mail.php is at: \domain\mail\ Or is there some kind of other configuration that I missed? I only uploaded Mail and PEAR base files via ftp, did nothing extra Thanks Quote Link to comment https://forums.phpfreaks.com/topic/201784-php-pear-mail-help/ Share on other sites More sharing options...
shawngoldw Posted June 2, 2010 Share Posted June 2, 2010 Try require_once "Mail.php"; Quote Link to comment https://forums.phpfreaks.com/topic/201784-php-pear-mail-help/#findComment-1066622 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.