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

This commit is contained in:
Thomas Bruederli 2013-11-06 11:37:47 +01:00
parent 60b9d544ad
commit 03c4261caf
2 changed files with 18 additions and 1 deletions

View file

@ -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

View file

@ -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'));
}
@ -115,6 +116,20 @@ class calendar_itip
return $sent;
}
/**
* 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