Roundcube Community Forum

 

SMTP help

Started by ashhail, April 28, 2014, 02:50:08 PM

Previous topic - Next topic

ashhail

Hello everyone,

I am very new to roundcube and am having some problems. I will give you the rundown and the code and maybe one of you can help. I have 3 different emails (outlook, yahoo, aol). I want to use their IMAP and SMTP servers via which one I am logged into. so if I am the hotmail user I use the hotmail SMTP, and so on. I am currently using rackspace as my host.

here is my config.

<?php

$config
['db_dsnw'] = 'mysql://XXXXXXXX:XXXXXXX@localhost/roundcubemail';

$config['default_host'] = array(
'ssl://imap.mail.yahoo.com' => 'yahoo.com',
'ssl://imap.yandex.com' => 'yandex.com',
'ssl://imap-mail.outlook.com' => 'outlook.com',
'ssl://imap.aol.com' => 'aol.com');

$config['include_host_config'] = array(
'ssl://imap.mail.yahoo.com' => 'yahoo.config.inc.php',
'ssl://imap-mail.outlook.com' => 'outlook.config.inc.php',
'ssl://imap.aol.com' => 'aol.config.inc.php');

//$config['plugins'] = array('');


now here is what the yahoo.config.inc.php looks like
<?php

$config
['db_dsnw'] = 'mysql://XXXXXXXX:XXXXXXXXXXXXXXXX@localhost/roundcubemail';

$config['default_host'] = 'ssl://imap.mail.yahoo.com:993';

$config['smtp_server'] = 'ssl://smtp.mail.yahoo.com:465';

$config['smtp_user'] = '%u';

$config['smtp_pass'] = '%p';
$config['smtp_auth_type'] = 'LOGIN';

//$config['des_key'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxx';

//$config['plugins'] = array()

//$config['username_domain'] = 'yahoo.com';


I have even tried hardcoding the username and password in it and it didn't work. thinking it is reverting to the default for some reason. not sure though
I can get mail from all three of these but when I try to send it doesn't work. any help would be appreciated. I have searched the forums but haven't found any of the posts to help me for some reason. might be a config error, my error, or the universe

also something that is weird... no error in logs


thanks in advance

ashhail

#1
UPDATE - and I must be the only one with this problem...  :'(

If I take a user from one of the other configs - I used the yahoo.con user and put it into the config.inc.php the email sent just fine.

after that I changed my config file to look like this


<snip>
$config['default_host'] = array(
'ssl://imap.mail.yahoo.com' => 'yahoo.com',
'ssl://imap.yandex.com' => 'yandex.com',
'ssl://imap-mail.outlook.com' => 'outlook.com',
'ssl://imap.aol.com' => 'aol.com');

$config['smtp_server'] = array('ssl://smtp.mail.yahoo.com', 'ssl://imap.yandex.com', 'tls://smtp.aol.com', 'tls://smtp-mail.outlook.com');

$config['include_host_config'] = array(
'ssl://imap.mail.yahoo.com' => 'yahoo.config.inc.php',
'ssl://imap.yandex.com' => 'yandex.config.inc.php',
'ssl://imap-mail.outlook.com' => 'outlook.config.inc.php',
'ssl://imap.aol.com' => 'aol.config.inc.php',
'ssl://smtp.mail.yahoo.com' => 'yahoo.config.inc.php',
'ssl://imap.yandex.com' => 'yandex.config.inc.php',
'tls://smtp.aol.com' => 'aol.config.inc.php',
'tls://smtp-mail.outlook.com' => 'outlook.config.inc.php');


now I get an error message
SMTP Error (-1): Connection to server failed.

in the log it says
[29-Apr-2014 15:26:07 UTC] PHP Warning:  parse_url() expects parameter 1 to be string, array given in /var/www/roundcube/program/lib/Roundcube/rcube_smtp.php on line 78
[29-Apr-2014 15:26:07 UTC] PHP Warning:  preg_match() expects parameter 2 to be string, array given in /var/www/roundcube/program/lib/Roundcube/rcube_smtp.php on line 92
[29-Apr-2014 15:26:07 UTC] PHP Warning:  strpos() expects parameter 1 to be string, array given in /var/www/roundcube/program/lib/Roundcube/rcube_utils.php on line 889
[29-Apr-2014 15:26:07 UTC] PHP Warning:  idn_to_ascii() expects parameter 1 to be string, array given in /var/www/roundcube/program/lib/Roundcube/rcube_utils.php on line 897
[29-Apr-2014 15:26:07 UTC] Connection refused (111):
[29-Apr-2014 15:26:07 UTC] Failed to connect socket: Connection refused ():
[29-Apr-2014 15:26:07 +0000]: SMTP Error: SMTP error: Connection failed: Failed to connect socket: Connection refused in /var/www/roundcube/program/lib/Roundcube/rcube.php on line 1497 (POST /roundcube/?_task=mail&_unlock=loading1398785169501&_lang=en_US?_task=mail&_action=send)


I seem to be getting closer -- anyone have any ideas now?

trying to add as much info as possible :)

JohnDoh

the value of $config['smtp_server'] has to be a string not an array. it only accepts one server.

also with $config['include_host_config'] the array key is the host name used to access your site not the imap host (see http://trac.roundcube.net/wiki/Howto_Config/Multidomains)

i think the only way you can change the smtp server is either to put some of your own logic into the config file or make a plugin which will check the imap host and then set the smtp server.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

ashhail

#3
have any of you used one of these two plugins...

discovery - https://bitbucket.org/hostingtek/discovery/overview
multiple_smtp_server - https://github.com/unstko/Roundcube-plugins/tree/master/multiple_smtp_server

wondering if one of those two would work for this?


UPDATE
the multiple_smtp_server doesn't work with version 1.0


so let me make sure I understand this


<?php

$config
['default_host'] = array(
'ssl://imap.mail.yahoo.com' => 'yahoo.com',
'ssl://imap.yandex.com' => 'yandex.com',
'ssl://imap-mail.outlook.com' => 'outlook.com',
'ssl://imap.aol.com' => 'aol.com');
//$config['default_host'] = 'localhost';

$config['include_host_config'] = 'true';



aol.config.inc.php

<?php

$config
['db_dsnw'] = 'mysql://roundcube:P@$$w0rd@localhost/roundcubemail';
$config['default_host'] = 'ssl://imap.aol.com:993';
$config['smtp_server'] = 'tls://smtp.aol.com:587';
$config['smtp_user'] = '%u';
$config['smtp_pass'] = '%p';
$config['des_key'] = 'J4a0OCnv=UF?gEP_EUX%Nox7';
$config['username_domain'] = 'aol.com';


is there a reason when it switches to the right config file it doesn't use that config files smtp settings like it does the imap ones?  does smtp need to be defined in config.inc.php only or it wont work?

sorry - bare with me still new to this :(

JohnDoh

are you sure it is using any values from your aol.config.inc.php file?

like i said before host specifc config files are loaded based on the host name used to access Roundcube, it has nothing to do with which IMAP server you are using and the name aol.config.inc.php will not be picked up automatically by anything, unless you use the host "aol.config" to access you Roundcube.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...