plugins/calendar

Thomas Brüderli bruederli at kolabsys.com
Wed Nov 6 11:37:56 CET 2013


 plugins/calendar/config.inc.php.dist   |    4 +++-
 plugins/calendar/lib/calendar_itip.php |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 03c4261cafd687b967537ba0f324d019c1832764
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Nov 6 11:37:47 2013 +0100

    Allow to override smtp_server config option to fall back to PHP mail() function for unauthenticated iTip response sending

diff --git a/plugins/calendar/config.inc.php.dist b/plugins/calendar/config.inc.php.dist
index 115101c..449041c 100644
--- a/plugins/calendar/config.inc.php.dist
+++ b/plugins/calendar/config.inc.php.dist
@@ -110,7 +110,9 @@ $rcmail_config['calendar_allow_invite_shared'] = false;
 // enable asynchronous free-busy triggering after data changed
 $rcmail_config['calendar_freebusy_trigger'] = false;
 
-// SMTP server host used to send (anonymous) itip messages
+// SMTP server host used to send (anonymous) itip messages.
+// Set to '' in order to use PHP's mail() function for email delivery.
+// To override the SMTP port or connection method, provide a full URL like 'tls://somehost:587'
 $rcmail_config['calendar_itip_smtp_server'] = null;
 
 // SMTP username used to send (anonymous) itip messages
diff --git a/plugins/calendar/lib/calendar_itip.php b/plugins/calendar/lib/calendar_itip.php
index dc9a692..9011073 100644
--- a/plugins/calendar/lib/calendar_itip.php
+++ b/plugins/calendar/lib/calendar_itip.php
@@ -37,6 +37,7 @@ class calendar_itip
     $this->rc = $cal->rc;
     $this->sender = $identity ? $identity : $this->rc->user->get_identity();
 
+    $this->cal->add_hook('message_before_send', array($this, 'before_send_hook'));
     $this->cal->add_hook('smtp_connect', array($this, 'smtp_connect_hook'));
   }
 
@@ -116,6 +117,20 @@ class calendar_itip
   }
 
   /**
+   * Plugin hook triggered by rcube::deliver_message() before delivering a message.
+   * Here we can set the 'smtp_server' config option to '' in order to use
+   * PHP's mail() function for unauthenticated email sending.
+   */
+  public function before_send_hook($p)
+  {
+    if ($this->itip_send && !$this->rc->user->ID && $this->rc->config->get('calendar_itip_smtp_server', null) === '') {
+      $this->rc->config->set('smtp_server', '');
+    }
+
+    return $p;
+  }
+
+  /**
    * Plugin hook to alter SMTP authentication.
    * This is used if iTip messages are to be sent from an unauthenticated session
    */




More information about the commits mailing list