1) $config['smtp_host'] = '10.5.2.1:587';
2) $config['smtp_host'] = 'localhost:587';
Sometimes it can work (depend your smtp server config), but in more cases its incorrect settings.
This partially correct:
If you use 465 or 587 port - you must use SSL:// or TLS:// prefix before hostname, for example like this
$config['smtp_[host'] = 'ssl://wo-lar.com:587';
or
$config['smtp_[host'] = 'ssl://wo-lar.com:465';
or
$config['smtp_[host'] = 'tls://wo-lar.com:587';
or
$config['smtp_[host'] = 'tls://wo-lar.com:465';