Mail sending is slow on some servers.
PHP Pear mail module can be used to send mails in these scenarios.
Following are the steps for configurations/changes to be made: -
I] On Linux server: -
1.Activate Pear mail module by installing it on server with the command below: -
pear install --alldeps Mail
2.Set sendmail path in system’s php configuration file (php.ini)
sendmail_path = /usr/sbin/sendmail -t -i –odb
Increase memory limit in php.ini
memory_limit = 32M
II] In deployed Drupal’s folder: -
1. Create a smtpmail.inc file in includes directory with following code blocks: -
<?php
require_once 'Mail.php';
require_once 'PEAR.php';
function drupal_mail_wrapper($message) {
global $smtpmail;
$headers['From'] =$message['from'];
if ( empty($headers['To'])) {
$headers['To'] = $message['to'];
}
$headers['Subject'] = $message['subject'];
$recipients = $message['to'];
$mail_object =&Mail::factory('smtp', $smtpmail);
$output = $mail_object->send($recipients, $message['headers'], $message['body'], $message['subject']);
return $output;
}
2. Modify mail setting codes given below in settings.php present in sites->default directory: -
/*PHP Pear mail module settings */
$conf = array(
'smtp_library' => 'includes/smtpmail.inc'
);
global $smtpmail;
$smtpmail= array();
$smtpmail["host"] = 'smtp.gmail.com';
$smtpmail["auth"] = TRUE;
$smtpmail["username"] = '
info@objectseek.com';
$smtpmail["password"] = 'info@osit';