Codeigniter SMTP Unable to Connect
i dont know if this would work in your case, but i have the same issue. it work on my local development using homestead but in hostgator its error. what i did to fix it, is i change the value of protocol to mail.
try to change your code:
$config['protocol'] = 'smtp';
to this:
$config['protocol'] = 'mail';