MyBB Community Forums

Full Version: PM e-mails and e-mail subscription alerts seem delayed
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8
Its a VPS - no cpanel, all from the command line. Smile I think it might be related to that link, but do I need SNMP?
(2015-09-23, 01:08 PM)Leefish Wrote: [ -> ]Its a VPS - no cpanel, all from the command line. Smile I think it might be related to that link, but do I need SNMP?

If you don't know, then you probably don't Smile It's used in big industries quite often but you can safely remove it unless you're actively using any SNMP traps.
(2015-03-15, 02:43 PM)Euan T Wrote: [ -> ]Hi,

Here is the PHP file that should process the mail queue:

<?php

defined('IN_MYBB') or define('IN_MYBB', true);

require_once __DIR__ . '/init.php';

$numToSend = 20;

send_mail_queue($numToSend);


It should be uploaded to "./inc/cron_mail_queue.php". The crontab entry to run this every 5 minutes should be as follows (assuming PHP is at /usr/bin/php):

*/5 * * * * /usr/bin/php  /var/www/path_to_mybb/inc/cron_mail_queue.php

Hopefully that will work Big Grin
Has this been intergrated with a patch or should this be used today?

Cheers
If you have access to add Cron jobs, the above should still be used today.
I have this problem as well. Default is 10 but my forums is large enough the queue builds up and 10 just isn't going to work.

I set it to default 100. This should be an acp setting with 0=disable queue.

Also why not add this as a task? That would seem easiest imho.

Simple solution with a task.

I named the file mailqueue.php but call it whatever you want and upload it to inc/tasks/
<?php

function task_mailqueue($task)
{
	global $db, $mybb;
	
	send_mail_queue(100);
	
	add_task_log($task, "Mail Queue sent.");
}
?>


Alter the 100 to whatever number your forum needs. I set the task in acp to run every 10 minutes. Simple solution imho which won't get overwritten by any updates.
(2017-12-10, 09:42 AM)labrocca Wrote: [ -> ]I have this problem as well. Default is 10 but my forums is large enough the queue builds up and 10 just isn't going to work.

I set it to default 100.  This should be an acp setting with 0=disable queue.

Also why not add this as a task?  That would seem easiest imho.

Simple solution with a task.  

I named the file mailqueue.php but call it whatever you want and upload it to inc/tasks/
<?php

function task_mailqueue($task)
{
	global $db, $mybb;
	
	send_mail_queue(100);
	
	add_task_log($task, "Mail Queue sent.");
}
?>


Alter the 100 to whatever number your forum needs.  I set the task in acp to run every 10 minutes.  Simple solution imho which won't get overwritten by any updates.

A task would certainly make sense in my opinion. It might also make sense to retry emails if they fail (I can't remember if we do so now, or if we just drop them and log the error).

As part of 1.10 I'm already working on changing up how we send emails, so I'll try and make some changes relating to mass mail and the mail queue whilst I'm doing so.
Quote:(I can't remember if we do so now, or if we just drop them and log the error).

It logs the errors already.

And yes, please consider this a task instead of an add_shutdown function which I've personally have always found buggy and in my custom code for 1.6x I actually removed it entirely. Smile Haven't done so in 1.8x.

Quote:As part of 1.10 I'm already working on changing up how we send emails

If you need suggestions or have questions LMK. I certainly have a lot of experience when it comes to sending a ton of email through MyBB and making changes to ensure they make it.

One thing I do from my SMTP provider is actually use their API to check if the email is unsubscribed before I send them the email. If the email is bounced, invalid, or unsubscribed the user gets a notice on the site along with a link to correctly resubscribe.

Emails aren't HTML friendly either which can be a problem.

So yeah, I agree with you that a lot more can be done to improve the emails.

btw, an issue is 0 hooks in my_mail function forcing me to hard code one into it. No hooks in inc/class_mailhandler.php either.
(2017-12-10, 06:31 PM)labrocca Wrote: [ -> ]
Quote:(I can't remember if we do so now, or if we just drop them and log the error).

It logs the errors already.  

And yes, please consider this a task instead of an add_shutdown function which I've personally have always found buggy and in my custom code for 1.6x I actually removed it entirely.  Smile  Haven't done so in 1.8x.  

Quote:As part of 1.10 I'm already working on changing up how we send emails

If you need suggestions or have questions LMK.   I certainly have a lot of experience when it comes to sending a ton of email through MyBB and making changes to ensure they make it.  

One thing I do from my SMTP provider is actually use their API to check if the email is unsubscribed before I send them the email.  If the email is bounced, invalid, or unsubscribed the user gets a notice on the site along with a link to correctly resubscribe.

Emails aren't HTML friendly either which can be a problem.  

So yeah, I agree with you that a lot more can be done to improve the emails.

btw, an issue is 0 hooks in my_mail function forcing me to hard code one into it.  No hooks in inc/class_mailhandler.php either.

So far the changes have mostly been limited to just dropping in SwiftMailer to do the actual SMTP and send mail parts. Adding a hook would certainly make sense, and would allow a bit more flexibility. Adding SwiftMailer should also allow there to be more transports to be added (for example, a transport to use MailGun’s HTTP API and check subscription status that way. My work in progress branch for these changes can be found here, though there is still much to do: https://github.com/mybb/mybb/pull/2918

Any suggestions for improvements are most welcome. 1.8.13 made some steps to fix and clean up email sending in some parts of the software by stopping attempting to spoof from addresses which has caused problems in the past, but there are still many improvements we can make.
I am on version 1.8.6 and subscription mails are triggered (and sent) only when I come back to the forum. Is this still an open issue?
Yes, the task system only runs when people browse your site, unless you configure cron to run it periodically.
Pages: 1 2 3 4 5 6 7 8