How to catch exceptions??

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
grvulture
Forum Newbie
Posts: 4
Joined: Tue Feb 17, 2009 1:07 pm

How to catch exceptions??

Post by grvulture »

why isn't this working???

Code: Select all

 try {
    if ($server) $smtp =& new Swift_Connection_SMTP($server); else $smtp =& new Swift_Connection_SMTP("localhost");
    if ($smtp_user) $smtp->setUsername($smtp_user);
    if ($password) $smtp->setpassword($password);
  } catch (Exception $e) {
    $this->setMessage ( 'Caught exception: '. $e->getMessage() );
    return;
  }
 
instead of catching it, I get a
Fatal error: Uncaught exception 'Swift_ConnectionException' with message 'Authentication failed using username
...and I'm :banghead:
grvulture
Forum Newbie
Posts: 4
Joined: Tue Feb 17, 2009 1:07 pm

Re: How to catch exceptions??

Post by grvulture »

ok, I need to sleep! can't see the obvious before my eyes

ignore the topic....

sorry :roll:
Post Reply