$smtp =& new Swift_Connection_SMTP("mail.henridoorten.nl");
$smtp->setUsername("info@henridoorten.nl");
$smtp->setpassword("password");
try{
$swift =& new Swift($smtp);
}catch (Swift_ConnectionException $e) {
echo "There was a problem communicating with SMTP: " . $e->getMessage();
}
But I still get the following error:
Fatal error:
Uncaught Error of type [Swift_ConnectionException] with message [Authentication failed using username 'info@henridoorten.nl' and password '********']
@0 include() in /usr/home/deb11522/domains/meubelproducten.nl/public_html/admin/show_order.php on line 4
@1 Swift::Swift() in /usr/home/deb11522/domains/meubelproducten.nl/public_html/admin/include/storingEmail.php on line 14
@2 Swift::connect() in /usr/home/deb11522/domains/meubelproducten.nl/public_html/admin/include/classes/Swiftmailer/Swift.php on line 109
@3 Swift::handshake() in /usr/home/deb11522/domains/meubelproducten.nl/public_html/admin/include/classes/Swiftmailer/Swift.php on line 230
in /usr/home/deb11522/domains/meubelproducten.nl/public_html/admin/include/classes/Swiftmailer/Swift/Errors.php on line 99
Why do I not catch the exception? What am I doing wrong?
try{
$smtp =& new Swift_Connection_SMTP("mail.henridoorten.nl");
$smtp->setUsername("info@henridoorten.nl");
$smtp->setpassword("password");
$swift =& new Swift($smtp);
}catch (Swift_ConnectionException $e) {
echo "There was a problem communicating with SMTP: " . $e->getMessage();
}
Edit | Actually I'm not so sure, considering the exception stacktrace shows it originates ffrom the Swift object
Use the PHP5 version. They're not real Exceptions in the PHP4 version since PHP4 did not have Exceptions. They're a nuisance to work with so just get the PHP5 version instead.