Can't Get Drupal to Send Mail

ChristopherC - September 16, 2009 - 19:32

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.

Try checking that the

bcobin - September 16, 2009 - 19:37

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...

ChristopherC - September 16, 2009 - 19:47

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

bcobin - September 16, 2009 - 20:01

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

ChristopherC - September 16, 2009 - 20:08

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

bcobin - September 16, 2009 - 20:16

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

ChristopherC - September 16, 2009 - 20:46

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

bcobin - September 16, 2009 - 20:50

Glad to be of service - happy phpmailing!

 
 

Drupal is a registered trademark of Dries Buytaert.