Mail sending is slow on server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hritab
Forum Newbie
Posts: 2
Joined: Mon Oct 26, 2009 2:23 am

Mail sending is slow on server

Post by hritab »

Why mail is taking time to be send on apache-linux server
DiscoDave
Forum Newbie
Posts: 4
Joined: Mon Oct 26, 2009 8:15 am

Re: Mail sending is slow on server

Post 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
hritab
Forum Newbie
Posts: 2
Joined: Mon Oct 26, 2009 2:23 am

Re: Mail sending is slow on server

Post 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';
Post Reply