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
is there anything in the back end that would cause e-mails to be delayed? by e-mails, I mean e-mail alerts on new PMs, e-mails from thread subscriptions, etc.

my server runs a very basic install of postfix...the PM e-mails and subscription e-mails seem to be delayed by like 30-40 minutes, meanwhile sending a test e-mail directly from the server goes through instantly.
basically it depends on visits to the forum and mail server queue system of your web server
(02-28-2015, 03:39 AM).m. Wrote: [ -> ]basically it depends on visits to the forum and mail server queue system of your web server

When are those emails supposed to go out?

I thought it was immediately....
bumping this.

what triggers mybb to send out e-mail alerts for stuff like PM notifications, subscription alerts, etc.?

I'm still seeing delays in getting e-mails about new PMs. for example, I'm getting tapatalk alerts about new PMs faster than the forum itself is sending an e-mail to me.
(02-28-2015, 03:39 AM).m. Wrote: [ -> ]basically it depends on visits to the forum and mail server queue system of your web server

I was told it wasn't queued in any way nor running via the task system.
http://community.mybb.com/thread-168263.html

I can understand it could be a mail queue issue on the web server but .m. has mentioned it 'depends on visits to the forum '.
If it depends on visits to the forum, is it being said that if someone sends a pm and then leaves the boards, it wont be despatched until another hit is made on the index page?
(03-10-2015, 07:54 AM)Wozzer Wrote: [ -> ]
(02-28-2015, 03:39 AM).m. Wrote: [ -> ]basically it depends on visits to the forum and mail server queue system of your web server

I was told it wasn't queued in any way nor running via the task system.
http://community.mybb.com/thread-168263.html

I can understand it could be a mail queue issue on the web server but .m. has mentioned it 'depends on visits to the forum '.
If it depends on visits to the forum, is it being said that if someone sends a pm and then leaves the boards, it wont be despatched until another hit is made on the index page?

yeah, I'd like to know what actually triggers mybb e-mails to be sent out...

tapatalk e-mail alerts are instant and sending e-mails directly from the server are instant as well.
more examples...

I received a PM last night at 9:31 pm. I got the tapatalk PM alert at 9:31 pm but didn't get the e-mail from the forum until 9:40 pm.

what is going on here?!!?!?
Hi,

It looks like mails for PMs use the mail queue:

				require_once MYBB_ROOT.'inc/class_parser.php';
				$parser = new Postparser;
				$pm['message'] = $parser->text_parse_message($pm['message'], array('me_username' => $pm['sender']['username'], 'filter_badwords' => 1, 'safe_html' => 1));
				$emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $pm['message']);
				$emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname'], $pm['subject']);
				$new_email = array(
					"mailto" => $db->escape_string($recipient['email']),
					"mailfrom" => '',
					"subject" => $db->escape_string($emailsubject),
					"message" => $db->escape_string($emailmessage),
					"headers" => ''
				);
				$db->insert_query("mailqueue", $new_email);
				$cache->update_mailqueue();

https://github.com/mybb/mybb/blob/featur...m.php#L653

The mail queue is processed via a PHP shutdown function (so every page load). I'm not 100% sure on the working of this, but it seems as though mails are only actually sent if the queue isn't currently locked (in use?) or hasn't been processed in the last 300 seconds (5 minutes): https://github.com/mybb/mybb/blob/featur...s.php#L255

This plus the natural short delay in sending and receiving emails is probably the cause of the problem.

Note also that I haven't looked much into the email system, and this is just what I can see from a quick search. It certainly seems to make sense though. Maybe other dev can chime in with a better answer.
(03-12-2015, 10:22 PM)Euan T Wrote: [ -> ]Hi,

It looks like mails for PMs use the mail queue:


 require_once MYBB_ROOT.'inc/class_parser.php';
 $parser = new Postparser;
 $pm['message'] = $parser->text_parse_message($pm['message'], array('me_username' => $pm['sender']['username'], 'filter_badwords' => 1, 'safe_html' => 1));
 $emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $pm['message']);
 $emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname'], $pm['subject']);
 $new_email = array(
 "mailto" => $db->escape_string($recipient['email']),
 "mailfrom" => '',
 "subject" => $db->escape_string($emailsubject),
 "message" => $db->escape_string($emailmessage),
 "headers" => ''
 );
 $db->insert_query("mailqueue", $new_email);
 $cache->update_mailqueue();

https://github.com/mybb/mybb/blob/featur...m.php#L653

The mail queue is processed via a PHP shutdown function (so every page load). I'm not 100% sure on the working of this, but it seems as though mails are only actually sent if the queue isn't currently locked (in use?) or hasn't been processed in the last 300 seconds (5 minutes): https://github.com/mybb/mybb/blob/featur...s.php#L255

This plus the natural short delay in sending and receiving emails is probably the cause of the problem.

Note also that I haven't looked much into the email system, and this is just what I can see from a quick search. It certainly seems to make sense though. Maybe other dev can chime in with a better answer.

I'm not sure if there's some bug in 1.8.4 or what, but e-mail alerts used to be instant..now there seems to be delays.  like I said, my mail server is bare bones, with it only running postfix...it'll send e-mails immediately from the server itself and if I try to send e-mails from 1 e-mail account to the other, it also seems to be instant.

hm...
Strange that it should only start in 1.8.4 if it's worked fine previously. The git blame doesn't show any changes for that release in any of the code I rooted out and I don't remember there being any email based changes whatsoever. That said, I'm not focused on the 1.x branch at the moment.

Is the mail server logging details about sending? Perhaps you could trace a PM through the mail server and see when it actually starts to be sent. Also, you could try outsourcing email sending to a service like Mandrill and see if it behaves any differently at all.
Pages: 1 2 3 4 5 6 7 8