mail with mail and sendmail

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
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

mail with mail and sendmail

Post by Heavy »

I just installed sendmail on my 166 MHz Pentium Linux Mandrak 9.0 Server.
I put a mail sender in my loginscript for a site just for testing:

Code: Select all

for ($a=0 ; $a<10 ; $a++)&#123;
		 mail( "a@b.c" , "tofo".($a+1) , $_POST&#1111;'LoginUserName']." har loggat in \n och detta spam har skickats ".($a+1)." ggr.\n\nHihi!" );
		&#125;
Now... This works SLOOOOWLY when sending only one mail ( $a = 1 ). But when trying to send several emails, it just does not get finished sending. I mean The login procedure hangs.

Is this a normal behaviour of "mail()" ? I mean. The user would think there is a problem when the request starts chewing seconds...

Background:
The email is sent to a true email adress on the internet. This server is located in a LAN that is routed to the Internet through an IDSN box. This box hangs up after say 30 seconds, so maybe the sendmail procedure doesn't like that. However, even if I keep the connection alive by surfing the web and checking for email all the time it doesn't do the job fast.

Any considerations i missed??
User avatar
DaZZleD
Forum Commoner
Posts: 38
Joined: Tue Jan 07, 2003 5:39 am

Post by DaZZleD »

of what i know the mail() function lets the mail server deal with the mails. it just issues the command. however if the mail server doesn't take the command while the script timeout ends, the script dies and the mails are not sent. try setting the script timeout to a longer period.
Post Reply