CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • CiviMail Bounce Reason character limit error
Pages: [1]

Author Topic: CiviMail Bounce Reason character limit error  (Read 2970 times)

civi5

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: MySQL 5
  • PHP version: 5.3.6
CiviMail Bounce Reason character limit error
February 27, 2013, 12:54:56 pm
I am using the latest version of civi 4.2.8, just upgraded last week. I started using the mailer this week and I was getting the dreaded "DB Error: unknown error".  I enabled the back trace and found that the bounce_reason was longer than the bounce_reason defined in MySQL.  The bounce reason in MySQL is a varchar of 255 but the actual reason code returned by a server can be any length.  The problem is if the length of the actual server bounce code is longer than the database field you get an error, at least is MySQL is running in strict mode.  The solution is simple either increase the field length or only store the first 255 characters in the database.  I solved it by adding a line to file /CRM/Mailing/Event/BAO/Bounce.php on line 77

if (empty($params['bounce_type_id'])) {
      $params['bounce_type_id'] = 11;
      if (empty($params['bounce_reason'])) {
        $params['bounce_reason'] = ts('Unknown bounce type: Could not parse bounce email');
      }
    }
   +++ $params['bounce_reason'] = substr($params['bounce_reason'], 0, 254);
    $bounce->copyValues($params);
    $bounce->save();
    $success = TRUE;

I am not sure if I should file a bug report for this or not.  I dont even know if this is the best place to make the change but it solves the length problem right before persisting to the database.  What is everyone else doing to prevent errors when you have a bounce_reason larger than 255 characters?  Do you not run MySQL is strict mode so it silently truncates the string?  I saw a couple of posts on this problem but none listed a final answer. 


Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviMail Bounce Reason character limit error
February 27, 2013, 01:09:05 pm

thanx for the analysis and patch

Can u please file an issue for this, we'll fix this for 4.3

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

civi5

  • I post occasionally
  • **
  • Posts: 39
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7
  • MySQL version: MySQL 5
  • PHP version: 5.3.6
Re: CiviMail Bounce Reason character limit error
February 27, 2013, 02:50:38 pm
Submitted.  Thanks for the quick response!

DaveT

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 1
  • CiviCRM version: 4.3.4
  • CMS version: Drupal 7
  • MySQL version: 5.5.28
  • PHP version: 5.3
Re: CiviMail Bounce Reason character limit error
June 07, 2013, 10:44:13 am
Has this been fixed in 4.3?  I am having similar problem (symptom - processing is not updating the Hold flag) and it seems to continue in 4.3

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: CiviMail Bounce Reason character limit error
June 07, 2013, 05:16:07 pm

its fairly easy for you to go check that file and see it it made it into 4.3, the file and line is mentioned in the initial postings

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

DaveT

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 1
  • CiviCRM version: 4.3.4
  • CMS version: Drupal 7
  • MySQL version: 5.5.28
  • PHP version: 5.3
Re: CiviMail Bounce Reason character limit error
June 08, 2013, 04:03:25 am
Got it.  I see it there.

Thanks for the teaching moment!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • CiviMail Bounce Reason character limit error

This forum was archived on 2017-11-26.