Emails are not being sent when page/post is created.

Attempting to setup the email to generate emails when content is added to the WordPress site. This is what is happening:

1. User registers email address with site.
2. Confirmation email sent successfully.
3. User confirms.
4. New page or post is created, but no email is being sent.

When checking the php_errors.log file there are a number of errors being generated below:

[05-Dec-2013 21:45:31 UTC] WordPress database error BLOB/TEXT column 'mail_settings' can't have a default value for query CREATE TABLE wp_8_subscriptions_log_table (
              id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
              mail_subject text NOT NULL,
              mail_recipients int(8) NOT NULL,
              mail_date bigint(20) NOT NULL,
              mail_settings text DEFAULT '',
              mails_list text DEFAULT '',
              max_email_ID bigint(20) NOT NULL,
              PRIMARY KEY  (id)
            )  ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by edit_post, wp_update_post, wp_insert_post, wp_transition_post_status, do_action('transition_post_status'), call_user_func_array, Incsub_Subscribe_By_Email->process_instant_subscriptions, Incsub_Subscribe_By_Email->send_mails, Incsub_Subscribe_By_Email_Model::get_instance, Incsub_Subscribe_By_Email_Model->__construct, Incsub_Subscribe_By_Email_Model->create_squema, Incsub_Subscribe_By_Email_Model->create_subscriptions_log_table, dbDelta
[05-Dec-2013 21:45:31 UTC] WordPress database error Table 'wordpress.wp_8_subscriptions_log_table' doesn't exist for query INSERT INTO <code>wp_8_subscriptions_log_table</code> (<code>mail_subject</code>,<code>mail_recipients</code>,<code>mail_date</code>,<code>mail_settings</code>,<code>mails_list</code>,<code>max_email_ID</code>) VALUES ('',0,1386258331,'','',5) made by edit_post, wp_update_post, wp_insert_post, wp_transition_post_status, do_action('transition_post_status'), call_user_func_array, Incsub_Subscribe_By_Email->process_instant_subscriptions, Incsub_Subscribe_By_Email->send_mails, Incsub_Subscribe_By_Email_Model->add_new_mail_log
[05-Dec-2013 21:45:31 UTC] PHP Warning:  Invalid argument supplied for foreach() in E:\wwwroot\wp-content\plugins\subscribe-by-email\inc\mail-templates\mail-template.php on line 315
[05-Dec-2013 21:45:31 UTC] WordPress database error Table 'wordpress.wp_8_subscriptions_log_table' doesn't exist for query UPDATE <code>wp_8_subscriptions_log_table</code> SET <code>mail_settings</code> = '' WHERE <code>id</code> = 0 made by edit_post, wp_update_post, wp_insert_post, wp_transition_post_status, do_action('transition_post_status'), call_user_func_array, Incsub_Subscribe_By_Email->process_instant_subscriptions, Incsub_Subscribe_By_Email->send_mails, Incsub_Subscribe_By_Email_Template->send_mail, Incsub_Subscribe_By_Email_Model->clear_mail_log_settings
[05-Dec-2013 21:45:52 UTC] WordPress database error BLOB/TEXT column 'mail_settings' can't have a default value for query CREATE TABLE wp_8_subscriptions_log_table (
              id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
              mail_subject text NOT NULL,
              mail_recipients int(8) NOT NULL,
              mail_date bigint(20) NOT NULL,
              mail_settings text DEFAULT '',
              mails_list text DEFAULT '',
              max_email_ID bigint(20) NOT NULL,
              PRIMARY KEY  (id)
            )  ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by do_action('subscriptions_page_sbe-sent-mails'), call_user_func_array, Incsub_Subscribe_By_Email_Admin_Page->render_page, Incsub_Subscribe_By_Email_Sent_Emails_Page->render_content, Incsub_Subscribe_By_Email_Log_Table->prepare_items, Incsub_Subscribe_By_Email_Model::get_instance, Incsub_Subscribe_By_Email_Model->__construct, Incsub_Subscribe_By_Email_Model->create_squema, Incsub_Subscribe_By_Email_Model->create_subscriptions_log_table, dbDelta
[05-Dec-2013 21:45:52 UTC] WordPress database error Table 'wordpress.wp_8_subscriptions_log_table' doesn't exist for query SELECT COUNT(*) FROM wp_8_subscriptions_log_table  made by do_action('subscriptions_page_sbe-sent-mails'), call_user_func_array, Incsub_Subscribe_By_Email_Admin_Page->render_page, Incsub_Subscribe_By_Email_Sent_Emails_Page->render_content, Incsub_Subscribe_By_Email_Log_Table->prepare_items, Incsub_Subscribe_By_Email_Model->get_log
[05-Dec-2013 21:45:52 UTC] WordPress database error Table 'wordpress.wp_8_subscriptions_log_table' doesn't exist for query SELECT * FROM wp_8_subscriptions_log_table  ORDER BY mail_date DESC LIMIT 0, 15 made by do_action('subscriptions_page_sbe-sent-mails'), call_user_func_array, Incsub_Subscribe_By_Email_Admin_Page->render_page, Incsub_Subscribe_By_Email_Sent_Emails_Page->render_content, Incsub_Subscribe_By_Email_Log_Table->prepare_items, Incsub_Subscribe_By_Email_Model->get_log

Note that it seems this may be limited to Windows installations only due to limitations in MySQL for Windows. Any ideas what the resolution would be or is this a bug?

  • pssdadmin

    Hi Ignacio,

    The plugin wasn't network activated, rather just activated for the one site. At the moment it is only happening on the one site as that was the only site it was activated on. But after reading the response, I did create a new blog and activated the plugin, however it appears to be the same results.

    [09-Dec-2013 22:21:21 UTC] WordPress database error BLOB/TEXT column 'mail_settings' can't have a default value for query CREATE TABLE wp_207_subscriptions_log_table (
                  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                  mail_subject text NOT NULL,
                  mail_recipients int(8) NOT NULL,
                  mail_date bigint(20) NOT NULL,
                  mail_settings text DEFAULT '',
                  mails_list text DEFAULT '',
                  max_email_ID bigint(20) NOT NULL,
                  PRIMARY KEY  (id)
                )  ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by edit_post, wp_update_post, wp_insert_post, wp_transition_post_status, do_action('transition_post_status'), call_user_func_array, Incsub_Subscribe_By_Email->process_instant_subscriptions, Incsub_Subscribe_By_Email->send_mails, Incsub_Subscribe_By_Email_Model::get_instance, Incsub_Subscribe_By_Email_Model->__construct, Incsub_Subscribe_By_Email_Model->create_squema, Incsub_Subscribe_By_Email_Model->create_subscriptions_log_table, dbDelta
    [09-Dec-2013 22:21:21 UTC] WordPress database error Table 'wordpress.wp_207_subscriptions_log_table' doesn't exist for query INSERT INTO <code>wp_207_subscriptions_log_table</code> (<code>mail_subject</code>,<code>mail_recipients</code>,<code>mail_date</code>,<code>mail_settings</code>,<code>mails_list</code>,<code>max_email_ID</code>) VALUES ('',0,1386606081,'','',2) made by edit_post, wp_update_post, wp_insert_post, wp_transition_post_status, do_action('transition_post_status'), call_user_func_array, Incsub_Subscribe_By_Email->process_instant_subscriptions, Incsub_Subscribe_By_Email->send_mails, Incsub_Subscribe_By_Email_Model->add_new_mail_log
    [09-Dec-2013 22:21:21 UTC] PHP Warning:  Invalid argument supplied for foreach() in E:\wwwroot\wp-content\plugins\subscribe-by-email\inc\mail-templates\mail-template.php on line 315
    [09-Dec-2013 22:21:21 UTC] WordPress database error Table 'wordpress.wp_207_subscriptions_log_table' doesn't exist for query UPDATE <code>wp_207_subscriptions_log_table</code> SET <code>mail_settings</code> = '' WHERE <code>id</code> = 0 made by edit_post, wp_update_post, wp_insert_post, wp_transition_post_status, do_action('transition_post_status'), call_user_func_array, Incsub_Subscribe_By_Email->process_instant_subscriptions, Incsub_Subscribe_By_Email->send_mails, Incsub_Subscribe_By_Email_Template->send_mail, Incsub_Subscribe_By_Email_Model->clear_mail_log_settings
    [09-Dec-2013 22:21:30 UTC] WordPress database error BLOB/TEXT column 'mail_settings' can't have a default value for query CREATE TABLE wp_207_subscriptions_log_table (
                  id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
                  mail_subject text NOT NULL,
                  mail_recipients int(8) NOT NULL,
                  mail_date bigint(20) NOT NULL,
                  mail_settings text DEFAULT '',
                  mails_list text DEFAULT '',
                  max_email_ID bigint(20) NOT NULL,
                  PRIMARY KEY  (id)
                )  ENGINE=MyISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci made by do_action('subscriptions_page_sbe-sent-mails'), call_user_func_array, Incsub_Subscribe_By_Email_Admin_Page->render_page, Incsub_Subscribe_By_Email_Sent_Emails_Page->render_content, Incsub_Subscribe_By_Email_Log_Table->prepare_items, Incsub_Subscribe_By_Email_Model::get_instance, Incsub_Subscribe_By_Email_Model->__construct, Incsub_Subscribe_By_Email_Model->create_squema, Incsub_Subscribe_By_Email_Model->create_subscriptions_log_table, dbDelta
    [09-Dec-2013 22:21:30 UTC] WordPress database error Table 'wordpress.wp_207_subscriptions_log_table' doesn't exist for query SELECT COUNT(*) FROM wp_207_subscriptions_log_table  made by do_action('subscriptions_page_sbe-sent-mails'), call_user_func_array, Incsub_Subscribe_By_Email_Admin_Page->render_page, Incsub_Subscribe_By_Email_Sent_Emails_Page->render_content, Incsub_Subscribe_By_Email_Log_Table->prepare_items, Incsub_Subscribe_By_Email_Model->get_log
    [09-Dec-2013 22:21:30 UTC] WordPress database error Table 'wordpress.wp_207_subscriptions_log_table' doesn't exist for query SELECT * FROM wp_207_subscriptions_log_table  ORDER BY mail_date DESC LIMIT 0, 15 made by do_action('subscriptions_page_sbe-sent-mails'), call_user_func_array, Incsub_Subscribe_By_Email_Admin_Page->render_page, Incsub_Subscribe_By_Email_Sent_Emails_Page->render_content, Incsub_Subscribe_By_Email_Log_Table->prepare_items, Incsub_Subscribe_By_Email_Model->get_log

    Let me know any further thoughts on this issue.

    Dros

  • Ignacio

    Hi @pssdadmin.

    I think that's an easy to fix one, though it will be fixed in the next release.

    You just need to open subscribe-by-email/model/model.php. Around line 130 you'll see two columns of the definition of the logs table:

    mail_settings text default '',
     mails_list text default '',

    text columns cannot have a default value in some systems, now change those lines for:

    mail_settings text,
     mails_list text,

    and deactivate/activate the plugin again in those sites.

    It should create the table now.

    Regards.
    Ignacio.