papaface Posted February 18, 2007 Share Posted February 18, 2007 Hello, I am trying to send emails using pear, and i get this message: Fatal error: Undefined class name 'mail' in register1.php on line 76 What does that mean? Please bare in mind in just learning how to send emails via pear. This is my code: $body = $email_content; $headers = array ('From' => $activation_email_from, 'To' => $submitted_email_address, 'Subject' => $activation_email_subject, 'MIME-Version' => "1.0\n", 'Content-type' => "text/html;charset=iso-8859-1\n"); $smtp = Mail::factory('smtp', //line 76 array ('host' => $_smtphostname, 'auth' => true, 'username' => $__getsmtpusername, 'password' => $__getsmtppassword)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo "We have now registered you as a member, thank you for registering, your username is " . $submitted_username; echo '<br>However there was a problem with dispatching your activation email. Please contact the site admin.'; } else { echo "We have now registered you as a member, thank you for registering, your username is " . $submitted_username; echo '<br>We have dispatched an activation email to the address provided. You must click on the link in the email to activate your membership.'; } Am I doing this correctly? Link to comment https://forums.phpfreaks.com/topic/39030-solved-pear-smtp/ Share on other sites More sharing options...
trq Posted February 18, 2007 Share Posted February 18, 2007 I dont see anywhere in your code where you have included the Mail class. Link to comment https://forums.phpfreaks.com/topic/39030-solved-pear-smtp/#findComment-187950 Share on other sites More sharing options...
papaface Posted February 18, 2007 Author Share Posted February 18, 2007 I havent, where can I find an example of the mail class? Link to comment https://forums.phpfreaks.com/topic/39030-solved-pear-smtp/#findComment-187955 Share on other sites More sharing options...
trq Posted February 18, 2007 Share Posted February 18, 2007 Have you got pear installed? Its part of pear obviously. Link to comment https://forums.phpfreaks.com/topic/39030-solved-pear-smtp/#findComment-187959 Share on other sites More sharing options...
papaface Posted February 18, 2007 Author Share Posted February 18, 2007 Yeah PEAR is installed... Link to comment https://forums.phpfreaks.com/topic/39030-solved-pear-smtp/#findComment-187961 Share on other sites More sharing options...
trq Posted February 18, 2007 Share Posted February 18, 2007 Then take a look at your PATH to see where pear is. eg; <?php echo get_include_path(); ?> From there it should be easy to work out how to include the Mail class into your scripts. Link to comment https://forums.phpfreaks.com/topic/39030-solved-pear-smtp/#findComment-187965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.