Changeset 111419 in spip-zone
- Timestamp:
- Aug 24, 2018, 3:04:55 PM (2 years ago)
- Location:
- _plugins_/mailshot/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/mailshot/trunk/bulkmailer/sparkpost.php
r110983 r111419 133 133 foreach($events as $e){ 134 134 if (isset($e['msys']['track_event'])) { 135 $event = &$e['msys']['track_event']; 136 // array("open", "click", "bounce", "spam", "blocked"); 137 $quoi = $event['type']; 138 if ($quoi == "open") { 139 $quoi = "read"; // open chez sparkpost, read ici 140 } 141 if ($quoi == "click") { 142 $quoi = "clic"; // click chez sparkpost, clic ici 143 } 144 if ($quoi == "bounce") { 145 $quoi = "soft_bounce"; // bounce chez sparkpost, soft_bounce ici 146 } 147 //if ($quoi=="blocked") $quoi="reject"; // blocked chez sparkpost, reject ici 148 149 $email = $event['rcpt_to']; 150 $tracking_id = $event['campaign_id']; 151 if ($tracking_id) { 152 $tracking_id = explode('/#', $tracking_id); 153 if (reset($tracking_id) == protocole_implicite($GLOBALS['meta']['adresse_site'])) { 154 $tracking_id = end($tracking_id); 155 spip_log("tracking $quoi $email $tracking_id", 'mailshot_feedback'); 156 // appeler l'api webhook mailshot 157 $feedback = charger_fonction("feedback", "newsletter"); 158 $feedback($quoi, $email, $tracking_id); 159 } 160 } 135 bulkmailer_sparkpost_webhook_track_event($e['msys']['track_event']); 136 } 137 if (isset($e['msys']['message_event'])) { 138 bulkmailer_sparkpost_webhook_message_event($e['msys']['message_event']); 161 139 } 162 140 } … … 167 145 } 168 146 147 function bulkmailer_sparkpost_webhook_track_event($event) { 148 // array("open", "click", "bounce", "spam", "blocked"); 149 $quoi = $event['type']; 150 if ($quoi == "open") { 151 $quoi = "read"; // open chez sparkpost, read ici 152 } 153 if ($quoi == "click") { 154 $quoi = "clic"; // click chez sparkpost, clic ici 155 } 156 if ($quoi == "bounce") { 157 $quoi = "soft_bounce"; // bounce chez sparkpost, soft_bounce ici 158 if (isset($event['bounce_class'])) { 159 switch ($event['bounce_class']) { 160 case "20": 161 case "21": 162 case "22": 163 case "23": 164 case "24": 165 case "25": 166 case "40": 167 case "60": 168 case "70": 169 case "100": 170 $quoi = "soft_bounce"; 171 break; 172 default: 173 $quoi = "hard_bounce"; 174 break; 175 } 176 } 177 } 178 if ($quoi == "out_of_band") { 179 $quoi = "soft_bounce"; 180 } 181 if ($quoi == "spam_complaint") { 182 $quoi = "spam"; 183 } 184 if ($quoi == "policy_rejection") { 185 $quoi = "reject"; 186 } 187 188 $email = $event['rcpt_to']; 189 $tracking_id = $event['campaign_id']; 190 if ($tracking_id) { 191 $tracking_id = explode('/#', $tracking_id); 192 if (reset($tracking_id) == protocole_implicite($GLOBALS['meta']['adresse_site'])) { 193 $tracking_id = end($tracking_id); 194 spip_log("tracking $quoi $email $tracking_id", 'mailshot_feedback'); 195 // appeler l'api webhook mailshot 196 $feedback = charger_fonction("feedback", "newsletter"); 197 $feedback($quoi, $email, $tracking_id); 198 } 199 } 200 } 201 202 function bulkmailer_sparkpost_webhook_message_event($event) { 203 return bulkmailer_sparkpost_webhook_track_event($event); 204 } 169 205 170 206 /** -
_plugins_/mailshot/trunk/paquet.xml
r110983 r111419 2 2 prefix="mailshot" 3 3 categorie="communication" 4 version="1.2 5.0"4 version="1.26.0" 5 5 etat="stable" 6 6 compatibilite="[3.0.5;3.2.*]"
Note: See TracChangeset
for help on using the changeset viewer.