3 * Test Generated example demonstrating the Mailing.submit API.
8 function mailing_submit_example() {
10 'scheduled_date' => '2014-12-13 10:00:00',
11 'approval_date' => '2014-12-13 00: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();
25 'error_message' => $errorMessage,
26 'error_code' => $errorCode,
27 'error_data' => $errorData,
35 * Function returns array of result expected from previous function.
40 function mailing_submit_expectedresult() {
42 $expectedResult = array(
54 'unsubscribe_id' => '5',
55 'resubscribe_id' => '6',
57 'name' => 'mailing name',
58 'from_name' => 'FIXME',
59 'from_email' => 'info@EXAMPLE.ORG',
60 'replyto_email' => 'info@EXAMPLE.ORG',
61 'subject' => 'Hello {contact.display_name}',
62 'body_text' => 'This is {contact.display_name}.
63 {domain.address}{action.optOutUrl}',
64 'body_html' => '<p>Look ma, magic tokens in the markup!</p>',
65 'url_tracking' => '1',
66 'forward_replies' => 0,
67 'auto_responder' => 0,
68 'open_tracking' => '1',
70 'msg_template_id' => '',
71 'override_verp' => '1',
73 'created_date' => '2013-07-28 08:49:19',
74 'scheduled_id' => '36',
75 'scheduled_date' => '20130728085413',
76 'approver_id' => '36',
77 'approval_date' => '20130728085413',
78 'approval_status_id' => '1',
79 'approval_note' => '',
81 'visibility' => 'Public Pages',
83 'dedupe_email' => '1',
84 'sms_provider_id' => '',
85 'hash' => '67eac7789eaee00',
86 'location_type_id' => 0,
87 'email_selection_method' => 'automatic',
92 return $expectedResult;
96 * This example has been generated from the API test suite.
97 * The test that created it is called "testMailerSubmit"
98 * and can be found at:
99 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php
101 * You can see the outcome of the API tests at
102 * https://test.civicrm.org/job/CiviCRM-master-git/
104 * To Learn about the API read
105 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
107 * Browse the api on your own site with the api explorer
108 * http://MYSITE.ORG/path/to/civicrm/api
110 * Read more about testing here
111 * http://wiki.civicrm.org/confluence/display/CRM/Testing
113 * API Standards documentation:
114 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards