Details
Description
To reproduce:
- Go to /civicrm/mailing/component and click disable for header and footer
- Try to send a mailing.
Actual results:
- The test mailing displays a blank screen (but mail sent)
- If no test is selected a (large) mysql error is displayed
Expected results:
Either:
- The disable links on the header and footer should be disabled
- An error should explain the problem when you create the mail, or
- The mailing should complete as
Analysis:
This occurs becuause of the following error:
[code] => -3
[message] => DB Error: constraint violation
[mode] => 16
[debug_info] => INSERT INTO civicrm_mailing (domain_id , reply_id ,
unsubscribe_id , optout_id , name , from_name , from_email , replyto_email ,
subject , body_text , body_html , is_template , url_tracking , forward_replies ,
auto_responder , open_tracking , is_completed ) VALUES ( 1 , 7 , 5 , 6 ,
'jtest 1' , 'Jesse' , 'jesse@snip' ,
'jesse@newprogressivecoalition.com' , 'civimail jtest 1' , 'test text file for
mail\r\n\r\nyeah, here we
go\r\n\r\nok\r\n\r\nend\r\n\r\n<p>
</p>\r\n<p>
{action.optOut}</p>\r\n<p>
{action.unsubscribe}</p>\r\n'
, '[snip body]' , 0 , 1 , 1 , 1 , 1 , 0 ) [nativecode=1216 ** Cannot add
or update a child row: a foreign key constraint fails]
Looking at this it appears that because there is no header or footer value specified in the INSERT statement, this causes them to attempt to use their defaults (NULL) which do not correspond to a child row, and hence the insert fails.