oceans Posted May 24, 2007 Share Posted May 24, 2007 Dear People, I have been talking about emailing earlier, a number of members, helped me! I just want to confirm. My code goes like this Process1 Process2 EMAIL Process3 Logically, the code goes from Process1, than Process2, than EMAIL (here the server waits for the email cycle to be over), than Process3. Is there any way we can avoid “(here the server waits for the email cycle to be over)”, you may suggest “API” like functions. I am afraid this “emailing wait cycle” hogs my codes. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/ Share on other sites More sharing options...
btherl Posted May 24, 2007 Share Posted May 24, 2007 Without knowing the details, I can suggest you put the emails into a queue, and have a seperate process which reads from the queue, dispatching emails. I would implement the queue as a database table. Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-260462 Share on other sites More sharing options...
oceans Posted May 24, 2007 Author Share Posted May 24, 2007 Dear Btherl, Sounds great, but I could not get your idea, if we trigger email, it will go at it is, can we set up a secondary email thread? Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-260494 Share on other sites More sharing options...
btherl Posted May 24, 2007 Share Posted May 24, 2007 What I am thinking of is a table like this: CREATE TABLE email_queue (email text, to text, headers text, content text, inserted datetime); Your main script adds rows to this table instead of sending actual emails. Then another script (which could run from cron, or could run constantly) just reads the queue like this: SELECT * FROM email_queue ORDER BY inserted ASC LIMIT 1 That fetches the oldest email's data, which you can then send off. The email sending script simply keeps fetching emails until none are left. Then it either waits or exits. Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-260497 Share on other sites More sharing options...
oceans Posted May 24, 2007 Author Share Posted May 24, 2007 Yes I understand, But a script, this has to be active 24/7, for that I need to have a page active in my pc 24/7, but I am renting a server space already. I have to pay for server space and keep my home pc on 24/7? Can I ask you a question, do you think I need to think this deep! trying to be over cautious? I will give you my situation, Say I get 100 concurrent hits! At times a client page will sent 10 emails consequtive max!. Will this be a problem hogging a client page and thus a server. I am renting a server space thus, this server has other hosts to take care too. Thanks, I feel overwhelmed! Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-260528 Share on other sites More sharing options...
oceans Posted May 24, 2007 Author Share Posted May 24, 2007 Dear People, Please post me you views, thanks. I do not know Am I trying to be too calculative, what is the uaual pratice in web based programming. I have not done mass emailing before. Your experience will save me days of work now or months of work later. Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-260585 Share on other sites More sharing options...
oceans Posted May 25, 2007 Author Share Posted May 25, 2007 Dear Friends, Please advice, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-261247 Share on other sites More sharing options...
oceans Posted May 25, 2007 Author Share Posted May 25, 2007 I am keepin this afloat! Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-261400 Share on other sites More sharing options...
btherl Posted May 28, 2007 Share Posted May 28, 2007 I haven't done mass emailing either But I have experience in queueing resource intensive jobs for background processing. In my experience, the best thing to do is to try it out. Your mail system should also be able to queue emails, so I doubt it will take long, unless you are actually attempting to send the emails directly to port 25, rather than letting your server's mail system handle them. Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-263024 Share on other sites More sharing options...
oceans Posted May 29, 2007 Author Share Posted May 29, 2007 Dear Btherl, Your reply made me think!!! I think I did not got my fundamentals right enough on emailing. I am using the following procedure <CODE> ini_set('smtp_port', $EmailingPort); ini_set(SMTP, "'".$EmailingSMTP."'"); $EmailingHeaders = "From: $EmailingFrom"; if (mail($EmailingTo,$EmailingSubject,$EmailingMessage,$EmailingHeaders)) { echo "Mail Sent."; } else { echo "Mail Not Sent."; } </CODE> Does this sends to port 25 direct, or it sends to the mailer server? Please help, if there is a way to send to mail server, and the mail server takes care, you have taken a TON off my back! Thanks a million in advance! Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-263709 Share on other sites More sharing options...
oceans Posted May 29, 2007 Author Share Posted May 29, 2007 Dear Experienced People, I really need your advice. Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-263956 Share on other sites More sharing options...
oceans Posted June 1, 2007 Author Share Posted June 1, 2007 Experienced paeoplr please give your view, I am keeping this thread alive for 5 days now. :'( Quote Link to comment https://forums.phpfreaks.com/topic/52746-emailing/#findComment-266068 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.