hai
i am new to PHP,i ahve a problem with sending mails from PHP using function mail()......actually it is not sending mails to all 5000 users..
here is my code
$x = 1;
$hold = 1000;
foreach($emails as $meru)
{
if($meru!=""){
if(send_japanese_mail($meru,$sub,$body,$from,$from_email,$bcc))
{
print "<img src=\"/img/hprog_02.gif\">";
flush();
}
if($x == $hold)
{ // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
sleep(3); //value must always be 3
$x=0;
}
$x++;
}//end of if mail address is not empty
}//end of foreach $mer
thanq in advance
sending around 5000mails at a time using mail() function php
Moderator: General Moderators
-
yerupalleyskumar
- Forum Newbie
- Posts: 8
- Joined: Wed Mar 17, 2004 11:04 pm
- Location: Tokyo
- Contact:
-
yerupalleyskumar
- Forum Newbie
- Posts: 8
- Joined: Wed Mar 17, 2004 11:04 pm
- Location: Tokyo
- Contact:
no
thanq for ur reply
Actually it is sending to all email ids but its taking a lot of memory space in linux server and wasting system resourses,so is there any better way of sending mails.......
guide me
bye
Actually it is sending to all email ids but its taking a lot of memory space in linux server and wasting system resourses,so is there any better way of sending mails.......
guide me
bye
-
yerupalleyskumar
- Forum Newbie
- Posts: 8
- Joined: Wed Mar 17, 2004 11:04 pm
- Location: Tokyo
- Contact:
how do i do that
hai ,i am new to PHP
how do i do that ???sample of code will be very helpful..............
thanq
suresh
how do i do that ???sample of code will be very helpful..............
thanq
suresh
It is worth noting that the mail() function is not suitable for larger volumes of email in a loop.
This function opens and closes an SMTP socket for each email... not very efficient.
To send email using sockets, I suggest reading this:
http://cr.yp.to/smtp.html
I would not recommend using the mail() function in PHP for anything over 100 mails, not even using it by breaking out your recipients in batches of 25, 50, 100 etc. and looping with the function.
The mail function in general is pretty weak - your best option would be to open a socket to SMTP and package up the mail in an env and send it at once by using 'RCPT TO:' in the SMTP connection.
Make your connection by using fsockopen() or popen().
Look through the user notes on fsockopen() and you will see a few examples of sending mail to SMTP using this...
Mark
This function opens and closes an SMTP socket for each email... not very efficient.
To send email using sockets, I suggest reading this:
http://cr.yp.to/smtp.html
I would not recommend using the mail() function in PHP for anything over 100 mails, not even using it by breaking out your recipients in batches of 25, 50, 100 etc. and looping with the function.
The mail function in general is pretty weak - your best option would be to open a socket to SMTP and package up the mail in an env and send it at once by using 'RCPT TO:' in the SMTP connection.
Make your connection by using fsockopen() or popen().
Look through the user notes on fsockopen() and you will see a few examples of sending mail to SMTP using this...
Mark
You may find the phpmailer-class handy for that.