Opened 4 years ago

Closed 4 years ago

#1485954 closed Feature Requests (fixed)

Get SMTP settings per user throug a plugin

Reported by: robinwaarts Owned by:
Priority: 5 Milestone: 0.3-stable
Component: Plugin API Version: git-master
Severity: normal Keywords: smtp per user
Cc:

Description

We use per-user settings for sending the mail so the outgoing email is authenticated through the users "own" mailserver to solve problems with mail signing (SPF/DKIM)..

There seems no way off changing the settings from a plugin, they are all reset when connecting to the SMTP server.

We made the following changes to /program/include/rcube_smtp.inc

function smtp_mail($from, $recipients, &$headers, &$body, &$response)
  {
  global $SMTP_CONN, $CONFIG, $RCMAIL;
  $smtp_timeout = null;

++  $CONFIG = $RCMAIL->plugins->exec_hook('smtp_settings', array('smtp_server' => $CONFIG['smtp_server'], 'smtp_port' => $CONFIG['smtp_port'],'smtp_server' => $CONFIG['smtp_user'], 'smtp_port' => $CONFIG['smtp_pass'], 'smtp_auth_type' => $CONFIG['smtp_auth_type']));

  $smtp_host = $CONFIG['smtp_server'];

Which solves our problem authenticating per user with data from our plugin..

This is the only patch I have to do manual when upgrading, I used to rewrite a few functions a while a go to get it to work..

So keep up the good work..

Change History (2)

comment:1 Changed 4 years ago by alec

  • Milestone changed from later to 0.3-stable

comment:2 Changed 4 years ago by thomasb

  • Resolution set to fixed
  • Status changed from new to closed

Hook added in [3ca3bd46] but now named smtp_connect. See Plugin_Hooks for details.

Note: See TracTickets for help on using tickets.