Hey, gang. I got the following error (redacted) after attempting to send a newsletter. This might be related to #1410330: Changing the language of a simplenews node throws a PDO error, but I'm doing everything in English. (I.e., there's no language switching.)

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'language' cannot be null: INSERT INTO {mail_logger} (mailkey, mailto, subject, body, mailfrom, headers, date_sent, language) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => simplenews_node [:db_insert_placeholder_1] => tom@example.com [:db_insert_placeholder_2] => Test [:db_insert_placeholder_3] => -------- TEST ---------------------------------------------------------------- Test Newsletter category [1] Unsubscribe from this newsletter [2] [1] http://example.com/newsletter/newsletter-category [2] http://example.com/newsletter/confirm/remove/aad32cdae42t10 [:db_insert_placeholder_4] => "Tom Geller" <tom@example.com> [:db_insert_placeholder_5] => a:11:{s:12:"MIME-Version";s:3:"1.0";s:12:"Content-Type";s:51:"text/plain; charset=UTF-8; format=flowed; delsp=yes";s:25:"Content-Transfer-Encoding";s:4:"8Bit";s:8:"X-Mailer";s:6:"Drupal";s:11:"Return-Path";s:15:"tom@example.com";s:6:"Sender";s:15:"tom@example.com";s:4:"From";s:30:""Tom Geller" <tom@example.com>";s:27:"Disposition-Notification-To";s:15:"tom@example.com";s:20:"X-Confirm-Reading-To";s:15:"tom@example.com";s:16:"List-Unsubscribe";s:61:"<http://example.com/newsletter/confirm/remove/aad62c1ae42t10>";s:10:"Precedence";s:4:"bulk";} [:db_insert_placeholder_6] => 1364087512 [:db_insert_placeholder_7] => ) in mail_logger_mail_alter() (line 115 of /home/example/webapps/drupalck/sites/all/modules/mail_logger/mail_logger.module).

Further complication: I'm doing this on top of Commerce Kickstart.

Ideas?

Comments

tgeller’s picture

To summarize a bit for ease of reading:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'language' cannot be null:

...

[:db_insert_placeholder_7] => ) in mail_logger_mail_alter() (line 115 of /home/example/webapps/drupalck/sites/all/modules/mail_logger/mail_logger.module).

tgeller’s picture

I've figured it out a bit more. When I create a newsletter node, the language column is set to "und". However much I run cron, I get the same error, and the newsletter's state remains "pending" (when I look at the Newsletter tab of the node).

If I go into the database and change the language value to "en", then run cron, I (a) no longer get the error, and (b) see that the newsletter's state has changed to "sent". HOWEVER, the mail logger doesn't show any mail going out!

So it's only half solved. Any help?

tgeller’s picture

Status: Active » Closed (works as designed)

A-ha! The issue seems to be the Mail Logger module, *not* Simplenews. (Turning off Mail Logger solves the problem.) I'll close this issue here and open a new one there.

tgeller’s picture

Status: Closed (works as designed) » Needs review

On second thought, perhaps someone can take a look at how these two modules play together, and help the other project pinpoint the problem. I've re-opened it, pending review.

tgeller’s picture

berdir’s picture

Status: Needs review » Active

There are two different things here.

You are using the mail_logger module, which seems to expect a non-empty language code and blows up if there isn't one. Try to disable that module (maillog.module should work fine).

The source of the problem seems to be that in some cases, simplenews subscribers don't have a language code, which is bad and we need to look into that but it doesn't blow up, until you use a module that expects the language code to be non-empty, as mail_logger seems to.

tgeller’s picture

Ah, so it's the user's language that matters, not the node's! Many thanks.

Also: maillog.module = https://drupal.org/project/maillog ?

tgeller’s picture

FYI, I tried https://drupal.org/project/maillog and it worked perfectly as a replacement to Mail Logger! Thanks again.

areynolds’s picture

Status: Active » Closed (works as designed)

@tgeller

BTW, @Berdir is absolutely correct; this is an issue with mail_logger. Thanks for the tip on Mail Log; will post a follow-up on the mail_logger issue on how to fix this issue, but I don't see any reason to deal with it if Mail Log works well: https://drupal.org/node/1952880