Jump to content
Sign in to follow this  
boxtel

[Contribution] Email Queue V1.2

Recommended Posts

one of the problems I faced was that on several occasions the response of the system was rather slow.

The main cause it seems was the email sending via smtp of the isp provider.

Checkout confirmation was one of those occasions especially if you add the additional email to the store owner.

 

Therefore, not being able to speed up the smtp, I decided to separate the email processing from the online

transaction. In short, I do not send the emails at that time but create them as before and store them in an email queue

to be processed later via a batch job. That job can run hourly or every minute.

The main benefit is that the online

transaction and thus the site response does no longer have to wait for the php mail function to complete.

Another is that you can save the emails send and thus no longer need to send copies to yourself.

 

This version includes some changes to the database as well as the processing.

It also has an admin side for viewing, holding, releasing, editing and deleting emails from the queue.

 

 

http://www.oscommerce.com/community/contributions,3184


Treasurer MFC

Share this post


Link to post
Share on other sites
one of the problems I faced was that on several occasions the response of the system was rather slow.

The main cause it seems was the email sending via smtp of the isp provider.

Checkout confirmation was one of those occasions especially if you add the additional email to the store owner.

 

Therefore, not being able to speed up the smtp, I decided to separate the email processing from the online

transaction. In short, I do not send the emails at that time but create them as before and store them in an email queue

to be processed later via a batch job. That job can run hourly or every minute.

The main benefit is that the online

transaction and thus the site response does no longer have to wait for the php mail function to complete.

Another is that you can save the emails send and thus no longer need to send copies to yourself.

 

This version includes some changes to the database as well as the processing.

It also has an admin side for viewing, holding, releasing, editing and deleting emails from the queue.

http://www.oscommerce.com/community/contributions,3184

 

 

Version 1.3 Tip: hold email by default.

 

if you would like the email queue to hold a specifuc type of email by default, do this :

 

 

change the function tep_store_mail() to this :

 

function tep_store_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $hold = '') {

 

if (SEND_EMAILS != 'true') return false;

 

$this_moment = date("Ymd") . ' ' . date("H:i:s");

 

$sql_data_array = array('to_name' => $to_name,

'charset' => CHARSET,

'to_address' => $to_email_address,

'subject' => $email_subject,

'text' => $email_text,

'from_name' => $from_email_name,

'from_address' => $from_email_address,

'last_updated' => $this_moment,

'created' => $this_moment,

'hold' => $hold);

 

tep_db_perform(TABLE_EMAIL_BATCH, $sql_data_array);

}

 

 

now for the email you want to hold, you add this : , 'on' after the current last parameter which is the from email address.

 

I do this for the "tell me why" emails so my email system does not overflow with meaningless statements.


Treasurer MFC

Share this post


Link to post
Share on other sites
Version 1.3 Tip: hold email by default.

 

if you would like the email queue to hold a specifuc type of email by default, do this :

change the function tep_store_mail() to this :

 

function tep_store_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $hold = '') {

 

if (SEND_EMAILS != 'true') return false;

 

$this_moment = date("Ymd") . ' ' . date("H:i:s");

 

$sql_data_array = array('to_name'      => $to_name,

                        'charset'      => CHARSET,

                        'to_address'  => $to_email_address,

                        'subject'      => $email_subject,

                        'text'        => $email_text,

                        'from_name'    => $from_email_name,

                        'from_address' => $from_email_address,

                        'last_updated' => $this_moment,

                        'created'      => $this_moment,

                        'hold'        => $hold);

 

tep_db_perform(TABLE_EMAIL_BATCH, $sql_data_array);

}

now for the email you want to hold, you add this : , 'on' after the current last parameter which is the from email address.

 

I do this for the "tell me why" emails so my email system does not overflow with meaningless statements.

 

for those of you who have added the email archive function, you need to change this statement in email_queue.php :

 

<td class="smallText" align="right"><?php echo $email_split->display_links($email_query_numrows, $max_results , MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page']); ?></td>

 

 

into this statement :

 

<td class="smallText" align="right"><?php echo $email_split->display_links($email_query_numrows, $max_results , MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'],'table=' . $_GET['table']); ?></td>

 

 

so you can page thru the archive as well.


Treasurer MFC

Share this post


Link to post
Share on other sites

Hi there,

 

Can you tell me what transport method is used for this Contrib??

 

I am unable to use sendmail with mu hosting service so I have installed the smtp Contrib which works fine but it has a problem when I try and send more than

one email at a time ie if I try and use the newsletter manager or one of the batch processing modules.

 

Will this also work with other contributions such as the recover cart sales?

this contribution is used to send an email to those customers that have exited the store without placing an order and still have items in their cart, this is also has a batch email function which I want to use but with the smtp contribution I am not able that is why I thought this Email Queue you have created may work with it

 

 

 

Cheers!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×