Roundcube Community Forum

 

patch for multiple smtp servers

Started by tauu, January 18, 2009, 12:19:56 PM

Previous topic - Next topic

SK-Sly

To allow storage of sent items in special sent folders for configured mail domains I patched the source.

File: program/steps/mail/sendmail.inc
search for the line "// Determine which folder to save message" and change the source:

// Determine which folder to save message
if ($savedraft)
  $store_target = $CONFIG['drafts_mbox'];
else {
  // begin: skr patch
  $sent_box = $CONFIG['sent_mbox'];
  $RCMAIL = rcmail::get_instance();
  list($dummy,$domain) = split("@",$from);
  $smtpConfig=$RCMAIL->config->getSmtpConfig($domain);
  $special_box = $smtpConfig['smtp_sent_mbox'];
  if($special_box != "") {
    $sent_box = $special_box;
  }
  $store_target = $sent_box;
  // end: skr patch
}

if ($store_target)
...

to configure this feature add the entry "smtp_sent_mbox'" to the mail domain specific smtp config:

$rcmail_config['smtp'] = array( 'domain1.de' => array( 'smtp_server' => 'smtp.domain1.de',
  'smtp_port' => 25,
  'smtp_user' => 'user',
  'smtp_pass' => 'password',
  'smtp_auth_type' => '',
  'smtp_helo_host' => '',
  'smtp_log' => TRUE,
  'smtp_debug' => TRUE,
  'smtp_sent_mbox' => ''),
'domain2.de' => array( 'smtp_server' => 'smtp.domain2.de',
  'smtp_port' => 25,
  'smtp_user' => 'user',
  'smtp_pass' => 'password',
  'smtp_auth_type' => '',
  'smtp_helo_host' => '',
  'smtp_log' => TRUE,
  'smtp_debug' => TRUE,
  'smtp_sent_mbox' => 'Sent_domain2'),
'default' => array( 'smtp_server' => 'default.smtp.de',
  'smtp_port' => 25,
  'smtp_user' => 'user',
  'smtp_pass' => 'password',
  'smtp_auth_type' => '',
  'smtp_helo_host' => '',
  'smtp_log' => TRUE,
  'smtp_debug' => TRUE,
  'smtp_sent_mbox' => '')
);

if no mail domain specific sent mbox is configured, the defautt configuration "sent_mbox" will be taken.

have fun!
Sly

PS: I think the better way would be to install an own smtp server...

bagstone

Quote from: glycome8472;23173I have posted a patched version of RoundCube at the URL below; which allows for mutliple SMTP servers on the same setup.  I've never written any PHP before so be careful.

roundcubemail-0.3.1_multismtp - Roundcube with multiple SMTP support

Does anyone still have this file? It's not available anymore.
I'm using RoundCube 0.3.1 and I'm searching desperately for this feature. If someone has this patch for 0.4.0, it would be nice, too, but I don't want to switch back to 0.2.x where multiple SMTP accounts were still supported.