This is wrong at so many levels:
if($this->mail_protocol == "pop3")
{
$port = "110";
}
else
{
if($mods["imap"]["SSL Support"] == "enabled" && ($this->ssltype == "tls" || $this->ssltype == "ssl"))
{
$port = "993";
}
else
{
$port = "143";
}
}
Whoever can name the most anti-patterns in this small snippet wins a honorable mention in the credits of this post.