CRM-19413 - CiviMail: Test mail notice errors: undefined index
authortschuettler <tschuettler@oxfam.de>
Mon, 26 Sep 2016 15:49:46 +0000 (17:49 +0200)
committerGitHub <noreply@github.com>
Mon, 26 Sep 2016 15:49:46 +0000 (17:49 +0200)
api/v3/Mailing.php

index 0a418e9a728661dca3e55ffd09979bda51910596..8ada60546b142bd409b30ecbcccdd70e29b81a9a 100644 (file)
@@ -588,9 +588,11 @@ function civicrm_api3_mailing_send_test($params) {
 
   $testEmailParams = _civicrm_api3_generic_replace_base_params($params);
   $testEmailParams['is_test'] = 1;
+  $testEmailParams['status'] = 'Scheduled';
+  $testEmailParams['scheduled_date'] = CRM_Utils_Date::processDate(date('Y-m-d'), date('H:i:s')); 
   $job = civicrm_api3('MailingJob', 'create', $testEmailParams);
   $testEmailParams['job_id'] = $job['id'];
-  $testEmailParams['emails'] = explode(',', $testEmailParams['test_email']);
+  $testEmailParams['emails'] = array_key_exists('test_email', $testEmailParams) ? explode(',', $testEmailParams['test_email']) : NULL;
   if (!empty($params['test_email'])) {
     $query = CRM_Utils_SQL_Select::from('civicrm_email e')
         ->select(array('e.id', 'e.contact_id', 'e.email'))