17 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
42 parent::__construct($pm);
44 if (!strlen(SQ_CONF_DEFAULT_EMAIL)) {
45 trigger_localised_error(
'SYS0315', E_USER_WARNING);
54 'recipients' => Array(
56 'type' =>
'serialise',
58 'description' =>
'The recipients to send this bulkmail to. All users/bulkmail_users in each group will become recipients',
60 'content_id' => Array(
64 'description' =>
'The asset we will be using as content in the email',
66 'content_gen' => Array(
68 'type' =>
'selection',
69 'default' =>
'one_user',
70 'description' =>
'The method of content generation',
71 'parameters' => Array(
73 'allow_empty' => FALSE,
75 'each_user' =>
'Generate as recipient',
76 'one_user' =>
'Generate as set user',
80 'content_gen_as' => Array(
84 'description' =>
'The user to generate the content with',
86 'content_design' => Array(
90 'description' =>
'The design to use for the content asset',
92 'content_layout' => Array(
96 'description' =>
'The layout to use for the content asset',
98 'server_details' => Array(
100 'type' =>
'serialise',
101 'default' => Array(
'driver' =>
'sendmail'),
102 'description' =>
'Details about which email server the bulkmails should be sent to',
107 'default' => SQ_CONF_DEFAULT_EMAIL,
108 'description' =>
'Sending address as per RFC822',
114 'description' =>
'Subject field of the email',
116 'header_details' => Array(
118 'type' =>
'serialise',
119 'default' => Array(),
120 'description' =>
'Extra header detail fields',
122 'threshold' => Array(
124 'type' =>
'serialise',
125 'default' => Array(),
126 'description' =>
'Threshold rules that will be enforced by the Bulk Mailer when it runs',
128 'threshold_types' => Array(
130 'type' =>
'serialise',
150 'description' =>
'Threshold rule types and their default values',
152 'bulkmail_mode' => Array(
154 'type' =>
'selection',
156 'parameters' => Array(
158 'allow_empty' => FALSE,
160 'live' =>
'Live Mode',
161 'test' =>
'Test Mode',
181 parent::_upgrade($current_version);
183 if (version_compare($current_version,
'0.2',
'<')) {
184 echo(
'UPGRADING BULKMAIL POST OFFICE FROM '.$current_version.
"\n");
190 pre_echo(
'Updating Bulkmail Post Offices...');
193 $bulkmail_post_offices = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids(
'bulkmail_post_office', FALSE, TRUE);
199 foreach ($bulkmail_post_offices as $id => $type) {
200 $post_office = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($id);
202 $server_details = $GLOBALS[
'SQ_SYSTEM']->am->getAttributeValuesByName(
'server_details',
'bulkmail_post_office', Array($post_office->id));
203 $server_details = unserialize($server_details[$post_office->id]);
204 if(isset($server_details[
'sendmail_path']) && !empty($server_details[
'sendmail_path']))
205 $sendmail_path = $server_details[
'sendmail_path'];
206 if(isset($server_details[
'sendmail_args']) && !empty($server_details[
'sendmail_args']))
207 $sendmail_args = $server_details[
'sendmail_args'];
209 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($post_office, TRUE);
216 $vars[
'SQ_TOOL_SENDMAIL_PATH'] = $sendmail_path;
217 $vars[
'SQ_TOOL_SENDMAIL_ARGS'] = $sendmail_args;
219 require_once SQ_INCLUDE_PATH.
'/external_tools_config.inc';
221 if (!$cfg->save($vars, FALSE, TRUE)) {
222 echo
"Sendmail path and arguments for bulkmail can not be saved\n";
227 pre_echo(
'Updated - '.$count.
' bulkmail post office(s)...');
229 pre_echo(
'BULKMAIL POST OFFICE SUCCESSFULLY UPGRADED TO VERSION 0.2');