Community & Support

Can't Get Drupal to Send Mail

Hello. I've been working with Drupal for a couple weeks, and have a module / feature that has me totally stumped. Every time I try to get the mail features going, I end up bringing down the entire site.

Here's what I've tried:

Downloaded and installed smtp-6.x-1-beta. Downloaded and installed phpmailer-6.x-2.1. I extract the PHP module inside the smtp folder (I've also tried right off the modules folder). Then I go in to the modules page and turn them on. Then, I go to the SMTP configuration area (where you enter sender name, password, etc) - once I click to Save, it tries to send a test and I get errors.

First error I get: Fatal error: require_once() [function.require]: Failed opening required 'sites/all/modules/smtp/phpmailer/class.phpmailer.php' (include_path='.:/usr/share/php:/usr/share/pear') in /etc/drupal/6/sites/all/modules/smtp/smtp.module on line 246

So, I figure it's missing this file "class.phpmailer.php". I keep reading (on support forums here, etc.) that I need to install the php class files. But I don't see these files in any of the zip files, and don't think I'm looking in the right place for them. So, I download the files from the only place I can find them from a google search. I then put them in the smtp/phpmailer folder.

Then, I get this error and the site goes down: warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'phpmailer_preview_access' was given in /usr/share/drupal6/includes/menu.inc on line 452.

I get the site back up by deleting the modules\smtp folder. But, obviously, mail still doesn't work.

My guess is I'm not getting the right "php class files", or not putting them in the right folder location or something. Can anyone help? Thanks.

Comments

Try checking that the

Try checking that the phpmailer folder is named "phpmailer" and not "phpMailer" (with the capital "M," which is how it downloads.)

This one bit me more than once - good luck!

Thanks bcobin... no luck though...

I just checked, and the folder was named "phpmailer" as you suggested. I really think the problem is tied to these "php class files". I'm either not loading them in the right spot, or not using the right files (I'm not sure where to get them). Any more suggestions?

Make sure you have write

Make sure you have write permissions enabled - the phpmailer folder and its contents sit right inside the module folder; nothing fancy.

Are you talking about actual

Are you talking about actual permissions on the server? That could be it, I'm going to check. Also, should the file class.phpmailer.php be in the phpmailer folder once I extract the zip file, or do I need to add it manually? I keep reading that I need that file, but I don't see it or know where to get it...

If you follow the

If you follow the instructions in the README.txt you should be OK - that's what I did, anyway. class.phpmailer.php should be in the phpmailer folder when you unzip it. Good luck!

Finally

Finally got it. I kept wondering why class.phpmailer.php wasn't in the phpmailer directory after I extracted it, and if I even needed it. So, instead of using phpmailer 6.x-2.1 (which didn't have the class.phpmailer.php file), I used version 2.2.1. It had all the files I needed. I'm new to Drupal - maybe I was just totally trying to use the wrong PHPMailer module. Anyway, once I used 2.2.1, I got a different error (which is good) that I got rid of easily by adjusting a couple items in the SMTP Authentication Support Page. Sent test mail and got it.

Thanks for your help!

Glad to be of service - happy

Glad to be of service - happy phpmailing!

unable to send mail

I thing that i have configured the smtp module and php mailer v 5.1 but when i send mail using the contact form i get in the front page three messages the two are warnings of unable to send message and after those one that says the message has been sent. Could this be resolved somehow?

unable to send mail

i have drupal 6.14 over Ubuntu server 8.04 , I installed postif and configure smtp.

libphp-phpmail in Debian/Ubuntu

PHPMail can be installed in Debian/Ubuntu systems with the libphp-phpmail package:

sudo apt-get install libphp-phpmail

This package installs the package to
/usr/share/php/libphp-phpmailer

This includes the required class.phpmailer.php, class.pop3.php, and class.smtp.php files.

You can then either copy these files to /etc/drupal/6/sites/all/modules/phpmailer/phpmailer (or wherever you have your modules installed):
sudo cp /usr/share/php/libphp-phpmailer/class* /etc/drupal/6/sites/all/modules/phpmailer/phpmailer

or you can do a symbolic link:

sudo ln -s /usr/share/php/libphp-phpmailer/* /etc/drupal/6/sites/all/modules/phpmailer/phpmailer/*

Alternatively, you can just install PHPMailer directly into the phpmail module folder:

cd /etc/drupal/6/sites/all/modules/phpmailer/phpmailer
sudo wget http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/PHPMailer%20v5.1/PHPMailer_v5.1.tar.gz/download
sudo tar zxvf PHPMailer_v5.1.tar.gz
sudo rm PHPMailer_v5.1.tar.gz
sudo cp ./PHPMailer_v5.1/class* .

Perspectoff
Ubuntuguide.org/wiki/Kubuntuguide

nobody click here