Author Topic: patch for multiple smtp servers  (Read 11954 times)

Offline SK-Sly

  • Newbie
  • *
  • Posts: 1
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...

Offline bagstone

  • Jr. Member
  • **
  • Posts: 22
patch for multiple smtp servers
« Reply #16 on: June 21, 2010, 05:51:21 PM »
Quote from: glycome8472;23173
I 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.