Category Archives: Uncategorized

Debugging duplicate query exec in WordPress

During debugging a plugin malfunction I had duplicate option update SQL queries and after som thinking I came up with the following debug line to catch the trace of duplicate function call: error_log(var_export(debug_backtrace(), true)); I placed it above the return … Continue reading

Posted in Uncategorized, wordpress | Tagged | Leave a comment

Mail sending via SMTP for WordPress

I was looking for some really simple SMTP solution for WordPress, only some code to send emails via SMTP. Without a plugin for localhost usage. Came up with the following script in wp-content/mu-plugins/smtp.php <?php add_action(‘phpmailer_init’, ‘custom_phpmailer_init’); function custom_phpmailer_init($phpmailer) { $phpmailer->IsSMTP(); … Continue reading

Posted in Uncategorized, wordpress | Tagged , | Leave a comment

Useful Postfix CLI commands to manage email queue

During dev I sometimes need to check what emails are scheduled to be sent. Display a list of queued mails sudo mailq View message in queue sudo postcat -vq QUEUE_ID Delete queued mail after debugging sudo postsuper -d ALL

Posted in postfix, Uncategorized | Tagged , , | Leave a comment

Fixing MailChimp error “Data did not match any of the schemas described in anyOf.”

While PUTing subscribers into MailChimp I got a bunch of “Data did not match any of the schemas described in anyOf.” error responses from the API server. Tried googling, but with no luck. Second try was to look at the … Continue reading

Posted in php, Uncategorized | Tagged , | Leave a comment

Fixing “Automatically populating $HTTP_RAW_POST_DATA is deprecated”

To reproduce try: curl -X POST -H “Content-Type: application/json” -d “{foo: bar}” http://example.com Great explanation can be found at https://www.bram.us/2014/10/26/php-5-6-automatically-populating-http_raw_post_data-is-deprecated-and-will-be-removed-in-a-future-version/ For me the solution on the shared hosting was adding the following line in .htaccess: php_value always_populate_raw_post_data -1 Thanks to https://www.drupal.org/node/2485847#comment-10068266

Posted in php, Uncategorized | Tagged , | Leave a comment

Customizing Monolog HTML formatter for email

Monolog can send emails when there’s an error, but in the provided HTML formatter I missed the REQUEST_URI and REMOTE_ADDR that triggered the error. Some info is in the exceptions section, but not always and needs horizontal scrolling in the … Continue reading

Posted in symfony, Uncategorized | Tagged , , , | 3 Comments

How Email Took Over Our Lives

Originally posted on Luca Sartoni:
When you recognize a task as complete, your brain releases dopamine, which makes you feel good and makes you want to repeat the behavior again to feel more pleasure. Eye-opening article by Jocelyn K. Glei…

Posted in Uncategorized | Leave a comment