3 * Test Generated example of using mailing create API
6 function mailing_create_example(){
9 'body_text' => 'bdkfhdskfhduew',
10 'name' => 'mailing name',
15 $result = civicrm_api3('mailing', 'create', $params);
17 catch (CiviCRM_API3_Exception
$e) {
19 $errorMessage = $e->getMessage();
20 $errorCode = $e->getErrorCode();
21 $errorData = $e->getExtraParams();
22 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
29 * Function returns array of result expected from previous function
31 function mailing_create_expectedresult(){
33 $expectedResult = array(
45 'unsubscribe_id' => '',
46 'resubscribe_id' => '',
48 'name' => 'mailing name',
49 'from_name' => 'FIXME',
50 'from_email' => 'info@EXAMPLE.ORG',
51 'replyto_email' => 'info@EXAMPLE.ORG',
53 'body_text' => 'bdkfhdskfhduew',
55 'url_tracking' => '1',
56 'forward_replies' => '',
57 'auto_responder' => 0,
58 'open_tracking' => '1',
60 'msg_template_id' => '',
61 'override_verp' => '1',
63 'created_date' => '2013-07-28 08:49:19',
65 'scheduled_date' => '20130728085413',
67 'approval_date' => '20130728085413',
68 'approval_status_id' => '',
69 'approval_note' => '',
71 'visibility' => 'User and User Admin Only',
74 'sms_provider_id' => '',
75 'api.mailing_job.create' => array(
84 'scheduled_date' => '20130728085413',
87 'status' => 'Scheduled',
100 return $expectedResult;
105 * This example has been generated from the API test suite. The test that created it is called
107 * testMailerCreateSuccess and can be found in
108 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/MailingTest.php
110 * You can see the outcome of the API tests at
111 * http://tests.dev.civicrm.org/trunk/results-api_v3
113 * To Learn about the API read
114 * http://book.civicrm.org/developer/current/techniques/api/
116 * and review the wiki at
117 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
119 * Read more about testing here
120 * http://wiki.civicrm.org/confluence/display/CRM/Testing
122 * API Standards documentation:
123 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards