Hello,
I have a campaign prepared for launching. To see if everything is OK I sent test emails to 8 of my own email addresses. Messages are sent and I receive them in my inboxes. Then they are sent again after 2 minutes (this is interval for sending emails scheduled task). And then again… and again… Until I manually delete them from Email Queue.
What could be wrong?
I checked suitecrm.log and found nothing there. Changed logging level do Debug. Still nothing.
SuiteCRM is installed on Linux with selinux enabled. I had a thought selinux might prevent emails to be deleted. So I disabled selinux but nothig changed.
Any idea on this?
Thanks.
Are those in the test target list? I think that allows for repeat sendings
Exactly. I have a target list named MyTest and type of this target list is TEST.
So this is as it was meant to be?
I am not 100% sure, but I think that test lists have that difference in behaviour. Maybe you can try sending to just a couple of your own email addresses, but from a regular (not test) target list, and check that they only get sent once, and are suppressed from further sendings.
Another thing that might be complicating things is that 2 minutes is quite a short time for that scheduled job. Often campaigns will take much longer than that to execute, no point in restarting the job while it is still ongoing. In fact, I fear that might have nasty consequences.
Keep your eye on the emailman db table, you will learn more about Campaigns from there.
And the code that sends is in modules/EmailMan/EmailMan.php
, check all the calls to set_as_sent function, those are all the various reasons why an address is skipped.
Unfortunately - it was not that. I made a new target list with the same target emails on it and with type Default.
Behavior is the same, just a bit different: The first email in the queue is sent over and over again. Others are not even tried.
I checked EmailMan.php and set_as_send but I’m not familiar with PHP and didn’t knew what to look for and what to do. Where does EmailMan leave its log notes? In suitecrm.log? Which logging level should I enable to see EmailMan actions?
About other proposals: Yes, I know 2 min interval is a bit dangerous for ending on blacklists. I set it to 2 min for testing purposes, otherwise I have it once a day.
Thanks.
You need to check two logs.
Please leave a generous time between executions of the job, I fear that the second execution could be exactly what is breaking the first one.
There is also a campaign_log table that might be relevant.
For the logging level, I suggest looking out for FATAL, ERROR and WARNING in a first approach, if that doesn’t bring any clues, go for full DEBUG mode.
I was not able to see anything wrong regarding marking emails as sent in suitecrm.log. Even more - there was nothing about set_as_sent there.
Then I checked php_errors.log and found this:
[07-Apr-2022 08:35:02 UTC] PHP Fatal error: Uncaught Exception: Database failure. Please refer to suitecrm.log for details. in /var/www/html/suitecrm/include/utils.php:1892
Stack trace:
#0 /var/www/html/suitecrm/include/database/DBManager.php(353): sugar_die()
#1 /var/www/html/suitecrm/include/database/DBManager.php(328): DBManager->registerError()
#2 /var/www/html/suitecrm/include/database/MysqliManager.php(179): DBManager->checkError()
#3 /var/www/html/suitecrm/include/database/DBManager.php(519): MysqliManager->query()
#4 /var/www/html/suitecrm/modules/Emails/Email.php(1807): DBManager->insert()
#5 /var/www/html/suitecrm/modules/Emails/Email.php(1586): Email->saveEmailText()
#6 /var/www/html/suitecrm/modules/EmailMan/EmailMan.php(596): Email->save()
#7 /var/www/html/suitecrm/modules/EmailMan/EmailMan.php(1152): EmailMan->create_ref_email()
#8 /var/www/html/suitecrm/modules/EmailMan/EmailManDelivery.php(258): EmailMan->sendEmail()
#9 /var/www/html/suitecrm/modules/Schedulers/_AddJobsHere.php(290): require('/var/www/html/s...')
#10 /var/www/html/suite in /var/www/html/suitecrm/include/utils.php on line 1892
In suitecrm.log there was only the error about writing email to MySQL because the message was already in the database.
Error inserting into table: emails_text: Query Failed: INSERT INTO emails_text XXXXXXXXXXXXXXXXXXXXXXXX MySQL error 1062: Duplicate entry for key XXXXXXXXXXXXXXXX 'PRIMARY'
This is understandable. When email was sent for the first time no error. At every consequent attempt there is this error.
But a FATAL error is always a worry, because whatever process was running has now been interrupted.
Maybe you can try clearing that from the database, maybe it was just a one-off inconsistency, and hopefully from now on things will go normally.
But if the error arises again, then surely some bug is happening… there are a lot of problems with email on SuiteCRM, but usually they’re not in Campaigns sending. I think that code has been stable and working for years, so I am finding your case quite strange…
OK. I did it all from the start again (sent campaign email) and checked all FATAL records in log.
I only got one FATAL about problem inserting into table: emails_text. I checked this table in database and found there many irrelevant old test emails there. I deleted them all and sending emails works like a charm from this point on.
Just a bit more about my problem history. Maybe it will be relevant to someone with similar problem in the future. I should mention this in the beginning but it just didn’t crossed my mind.
I moved my database from old server to a new one. Installed the same version of SuiteCRM, downloaded SQL form of my database content and then uploaded this to new server. Then my problems began.