Page 1 of 1

Mail sending is slow on server

Posted: Mon Oct 26, 2009 2:34 am
by hritab
Why mail is taking time to be send on apache-linux server

Re: Mail sending is slow on server

Posted: Mon Oct 26, 2009 8:27 am
by DiscoDave
My guess would be simply because the server is too slow, internet connection slow or the server is doing too much at the time of sending.

Disco

Re: Mail sending is slow on server

Posted: Tue Oct 27, 2009 4:20 am
by hritab
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';