3 * Test Generated example of using mailing submit API.
9 function mailing_submit_example() {
11 'scheduled_date' => '2014-12-13 10:00:00',
16 $result = civicrm_api3('mailing', 'submit', $params);
18 catch (CiviCRM_API3_Exception
$e) {
20 $errorMessage = $e->getMessage();
21 $errorCode = $e->getErrorCode();
22 $errorData = $e->getExtraParams();
24 'error' => $errorMessage,
25 'error_code' => $errorCode,
26 'error_data' => $errorData,
34 * Function returns array of result expected from previous function.
39 function mailing_submit_expectedresult() {
41 $expectedResult = array(
53 'unsubscribe_id' => '',
54 'resubscribe_id' => '',
56 'name' => 'mailing name',
57 'from_name' => 'FIXME',
58 'from_email' => 'info@EXAMPLE.ORG',
59 'replyto_email' => 'info@EXAMPLE.ORG',
60 'subject' => 'Hello {contact.display_name}',
61 'body_text' => 'This is {contact.display_name}',
62 'body_html' => '<p>This is {contact.display_name}</p>',
63 'url_tracking' => '1',
64 'forward_replies' => 0,
65 'auto_responder' => 0,
66 'open_tracking' => '1',
68 'msg_template_id' => '',
69 'override_verp' => '1',
71 'created_date' => '2013-07-28 08:49:19',
72 'scheduled_id' => '22',
73 'scheduled_date' => '20130728085413',
75 'approval_date' => '',
76 'approval_status_id' => '',
77 'approval_note' => '',
79 'visibility' => 'Public Pages',
82 'sms_provider_id' => '',
83 'hash' => '67eac7789eaee00',
84 'location_type_id' => '',
85 'email_selection_method' => '',
90 return $expectedResult;
94 * This example has been generated from the API test suite.
95 * The test that created it is called
98 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php
100 * You can see the outcome of the API tests at
101 * https://test.civicrm.org/job/CiviCRM-master-git/
103 * To Learn about the API read
104 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
106 * Browse the api on your own site with the api explorer
107 * http://MYSITE.ORG/path/to/civicrm/api
109 * Read more about testing here
110 * http://wiki.civicrm.org/confluence/display/CRM/Testing
112 * API Standards documentation:
113 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards