I'm using Drupal 6.2. I just installed it on Windows XP (using Web.Developer server suite from http://www.devside.net/) and right after creating my administrator account I get the following errors (as it obviously tried to send me an email):

* warning: mail() [function.mail]: Failed to connect to mailserver at "mail.gadmin.robinwinslow.co.uk" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\www\webapps\drupal-6.2\includes\mail.inc on line 193.
* Unable to send e-mail. Please contact the site admin, if the problem persists.

You see, I have an SMTP server, at mail.gadmin.robinwinslow.co.uk, but it requires authentication - so I have put the SMTP server in my php.ini file but there don't seem to be any options in there for authentication.

Many people before me seem to have had the same trouble, and there have been various hacks to get it working for previous versions of Drupal (version 4, mainly). I am rather surprised that as we're now on version 6 there isn't an inbuilt solution.

Ideally I would like to know if there are any extra lines I can add to php.ini for SMTP authentication? - that would be the simplest solution. Otherwise, could you let me know if there is another simple solution that won't require me to edit any php code in Drupal (as this means it almost certainly will break again if I upgrade)?

Ta,
Robin.

Comments

nottRobin’s picture

Okay so I've found out pretty conclusively that the native php mail() function doesn't allow for SMTP authentication. So I won't be able to do this in the php.ini file.

Several sites mentioned phpmailer (http://sourceforge.net/projects/phpmailer). Could someone tell me how to integrate this with Drupal? Presumably I have to edit some of Drupal's native code to make it use phpmailer rather than mail()? Could someone please tell me how to do that?

Thanks.

nitetalker’s picture

Like many I had problems getting Drupal to successfully send email. Simply editing php.ini and restarting Apache did not work for me. Instead I used the SMTP module and PHPMailer. It wasn't necessary to edit any Drupal core code. The lack of documentation for installing PHPMailer was an annoyance.

Here's what I did:

  1. Download the SMTP module.
  2. Extract the smtp folder to the sites\all\modules folder in your Drupal installation.
  3. In the sites\all\modules\smtp folder, create a subfolder named phpmailer.
  4. Download PHPMailer and extract the files class.phpmailer.php and class.smtp.php to the sites\all\modules\smtp\phpmailer folder.
  5. Browse to the Modules section of your Drupal site and enable the SMTP module.
  6. Browse to the SMTP settings page in your Drupal site http://yoursite/admin/settings/smtp, turn on the module, specify a destination email address for a test message, and click Save.
sanjanaa’s picture

Ya I do that, But the same problem is arise.