Permalink
Browse files

Fixed Adora Belle compatibility #5

At least a bit. HTML mails or attachments will probably not work.
  • Loading branch information...
1 parent 880cdd5 commit 8be939de39f6f1b4c6d999630d5b39634c3a6a03 @splitbrain committed Oct 19, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 action.php
View
@@ -63,6 +63,17 @@ function handle_message_send(&$event, $param){
// prepare message (Swift autodetects UTF-8)
$message =& new Swift_Message($event->data['subject'], $event->data['body']);
+ // did we get an Adora Belle Mailer object?
+ if(isset($event->data['mail']) && is_a($event->data['mail'],'Mailer')){
+ // we'd need to call cleanHeaders() here, but it's protected in Adora Belle.
+ // instead we call the dump() method which will call cleanHeaders for us
+ if(is_callable(array($event->data['mail'],'cleanHeaders()'))){
+ $event->data['mail']->cleanHeaders();
+ }else{
+ $event->data['mail']->dump();
+ }
+ }
+
// handle the recipients (duplicates some code from mail_encode_address)
$reci =& new Swift_RecipientList();
$from = null;
@@ -122,6 +133,7 @@ function handle_message_send(&$event, $param){
$event->preventDefault();
$event->stopPropagation();
$event->result = $ok;
+ $event->data['success'] = $ok;
}
}

0 comments on commit 8be939d

Please sign in to comment.