PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 8th, 2003, 02:44 PM
Clairvo Clairvo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 17 Clairvo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 23 m 32 sec
Reputation Power: 0
Script takes 1-2 minutes to send an email

I am using a simple script to send mail with php. The script works. I send an email to myself locally in Linux and I get it right. The problem is that the action of sending the email takes from 1 to 2 minutes which is unacceptable for the application. This has got to do with sendmail I think. I have seen a similar or maybe the same problem in this thread:
http://forums.devshed.com/showthrea...hlight=sendmail

But there was no answer for the problem.

If anyone has any idea, I'd love to read it. Thanks.

Clairvo

Reply With Quote
  #2  
Old March 8th, 2003, 03:11 PM
colpaarm's Avatar
colpaarm colpaarm is offline
300lb Bench!
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2001
Location: New York
Posts: 2,198 colpaarm User rank is Sergeant (500 - 2000 Reputation Level)colpaarm User rank is Sergeant (500 - 2000 Reputation Level)colpaarm User rank is Sergeant (500 - 2000 Reputation Level)colpaarm User rank is Sergeant (500 - 2000 Reputation Level)colpaarm User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 6 h 31 m 13 sec
Reputation Power: 18
The speed in which you receive email is dependent on a number of variables, none of which involve php. Are you using your own box or a hosting service? If you're using a hosting service, there's really nothing that you can do other than complain.

Assuming you're using your own box, you have to look at your routing scheme. How many domains are you using? Routers? Proxy servers?

Finally, if you're sending internet mail, you're at the mercy of the internet (obviously).

The bottom line is, you're asking a question that probably can't be answered in a forum like this.

Reply With Quote
  #3  
Old March 9th, 2003, 07:02 AM
Clairvo Clairvo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 17 Clairvo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 23 m 32 sec
Reputation Power: 0
OK, so I explained it all wrong....

I meant that the script "hangs" for 1-2 minutes, that is, it won't continue with the code under the mail() function, in this case a redirection using header(), until it is done with the mail, and that takes a lot for the application.

To put it clear, I am not talking about the time that the mail takes to reach the recipient but the time the mail() function takes to send the mail with sendmail and continue with the rest of the script.

Hope that I explained it better this time.

Thanks.

Clairvo

Reply With Quote
  #4  
Old March 9th, 2003, 10:58 AM
a.koepke's Avatar
a.koepke a.koepke is offline
Second highest poster :p
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jul 2001
Posts: 7,323 a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 13 m 55 sec
Reputation Power: 27
Is this your own server or is it one from a hosting provider. What it seems to be doing is waiting for sendmail to fully complete the mail sending. You need to switch sendmail into a queuing mode so that the message will get queued and then your script will work correctly
__________________
- Andreas Koepke

Koepke Photography


Reply With Quote
  #5  
Old March 9th, 2003, 01:56 PM
Clairvo Clairvo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 17 Clairvo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 23 m 32 sec
Reputation Power: 0
OK, a.koepke, I think you set me in the right direction. The computer is connected to my university's network. I told them the problem but they couldn't solve it. I cannot change things myself as I don't have root access but I can tell them ideas so they can try.

We use there the default call 'sendmail -t -i' in php.ini as I saw in the manual page http://www.php.net/manual/en/ref.mail.php (in the user notes).

I have been looking at a sendmail tutorial and it says that -i is for inmediate sending of mails and that this is very slow and not recommended. Instead, it says that the usual method is to use -b (of background) that makes sendmail generate a son to handle the mail.

I think that might be the solution, I can' t test it now because I can't change php.ini myself. Anyway I will let you know how I go.

Clairvo

Reply With Quote
  #6  
Old March 9th, 2003, 08:33 PM
a.koepke's Avatar
a.koepke a.koepke is offline
Second highest poster :p
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jul 2001
Posts: 7,323 a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 13 m 55 sec
Reputation Power: 27
Yes, that would be the right solution. Let me know how it goes

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Script takes 1-2 minutes to send an email


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT