nerd99 Posted July 23, 2010 Share Posted July 23, 2010 I am attempting to send an email from my website via SMTP. Knowing that my site's host supports PEAR I have used PEAR’s Mail function. Here is my code... <?php require_once "Mail.php"; $from = "Me <me@email>"; $to = "You <you@email>"; $subject = "Subject"; $body = "Insert Message Here"; $host = "hostdetails"; $username = "username"; $password = "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>"); } ?> This gave me an error saying: 'Class 'Net_SMTP' not found in /usr/local/php52/pear/Mail/smtp.php on line 210' So, using siteground as my host, I followed this tutorial - www.siteground.com/tutorials/php-mysql/pear_modules.htm and thanks to a very helpful blog entry (http://goonanism.com/blog/2010/06/08/using-pear-to-send-email-via-smtp/) I discovered that I needed to install the following packages in the following directories: pear /Mail /RFC822.php /mail.php /mock.php /null.php /sendmail.php /smtp.php /smtpmx.php /Net /SMTP.php /Socket.php /Mail.php /PEAR.php /PEAR5.php Back to the siteground tutorial, I created the php.ini file as directed. This is where I think I've gone wrong as I don't really know what I'm doing! I created a blank document and inserted the following code as directed: include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/my_cPanel_username/pear"; This file is saved in the following place: /public_html/php.ini Is this what they intended? Now, I am getting nothing. No error message, no message saying the email has been sent. The page loads fine but nothing has happened. Does anyone have any suggestions on what I could try or what the problem may be? Link to comment https://forums.phpfreaks.com/topic/208617-send-mail-with-smtp-no-error-message-but-not-working/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.