Jump to content

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/52746-emailing/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/52746-emailing/#findComment-260497
Share on other sites

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!

Link to comment
https://forums.phpfreaks.com/topic/52746-emailing/#findComment-260528
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/52746-emailing/#findComment-263024
Share on other sites

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!

 

Link to comment
https://forums.phpfreaks.com/topic/52746-emailing/#findComment-263709
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.