php mail REALLY slow

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
snakeman
Forum Newbie
Posts: 5
Joined: Fri Feb 18, 2005 10:30 am
Location: in the boat gettin' the line wet

php mail REALLY slow

Post by snakeman »

The following code is what I've been using for a long time. Now that I've changed servers, I had a hard time getting the mail function to work but now that I've got it working, it is EXTREMELY slow. Any ideas?

mail('info@mysite.com', $subject, $emailtext, $From) or
Die("Error sending mail :(");

I've got fedora1, php 4.3.8, sendmail, dovecot

Thanks so much for any help... By the way, getting and sending mail using a mail program like Outlook works great.
snakeman
Forum Newbie
Posts: 5
Joined: Fri Feb 18, 2005 10:30 am
Location: in the boat gettin' the line wet

Post by snakeman »

Nobody want to respond? Please? :D
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Well we can only guess but what's $From? I presume it's a proper From header and not just a plain email address?

Also if you have server access then watch your mail.log file as you test the script, you should be able to at least find out if the 'blockage' is on the PHP side or the email side.
jonemo
Forum Commoner
Posts: 28
Joined: Wed Feb 09, 2005 1:32 pm
Location: london, uk

Post by jonemo »

do you use sendmail or a smtp server?
snakeman
Forum Newbie
Posts: 5
Joined: Fri Feb 18, 2005 10:30 am
Location: in the boat gettin' the line wet

Post by snakeman »

sendmail

Here's what $From is...

$Sender = "someaddress <this@someaddress.com>\r\n";
$From .= 'From: ' . $Sender;
$From .= "X-Mailer: PHP\n"; //mailer
$From .= "X-Priority: 1\n"; //1 UrgentMessage, 3 Normal
$From .= "Content-Type: text/html; charset=iso-8859-1\n";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

have you tried changing/removing the priority setting? Is mail() being called multiple times? Is the mail server shared among several domains at the host?
snakeman
Forum Newbie
Posts: 5
Joined: Fri Feb 18, 2005 10:30 am
Location: in the boat gettin' the line wet

Post by snakeman »

It's shared but that's definitely not what's slowing it down. It's the only site using the mail function right now. Getting and receiving mail any other way is fast as lightening. Something's whack cause it takes like forever.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not, like, talk to your host, sha?
snakeman
Forum Newbie
Posts: 5
Joined: Fri Feb 18, 2005 10:30 am
Location: in the boat gettin' the line wet

Post by snakeman »

That's why I'm trying to figure this out. I am my host. 8O
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

oh, ok. well, from a quick google, it looks like sendmail combined with your network connection type and/or DNS resolution system.

"sendmail slow" was my google.
Post Reply