Fatal error: Class 'Swift' not found

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
panczel.levente
Forum Newbie
Posts: 2
Joined: Sun Sep 23, 2007 4:43 pm

Fatal error: Class 'Swift' not found

Post by panczel.levente »

Hello!
I use v3.3.2 with PHP5, and while assembling a message it says:
Fatal error: Class 'Swift' not found in <my_Swift_root_path>\Swift\Message.php on line 85
And indeed: I can't find where Message.php would load the Swift class, though it is being referenced on line 85 (or more obviously on line 87).
Only include_once()-ing Message.php has been sufficient in the past, so I suppose this change was not intentional.
I suggest everyone who has this same problem to circumvent it by including Swift.php right before Message.php!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Fatal error: Class 'Swift' not found

Post by Chris Corbyn »

panczel.levente wrote:Hello!
I use v3.3.2 with PHP5, and while assembling a message it says:
Fatal error: Class 'Swift' not found in <my_Swift_root_path>\Swift\Message.php on line 85
And indeed: I can't find where Message.php would load the Swift class, though it is being referenced on line 85 (or more obviously on line 87).
Only include_once()-ing Message.php has been sufficient in the past, so I suppose this change was not intentional.
I suggest everyone who has this same problem to circumvent it by including Swift.php right before Message.php!
I've probably introduced some coupling which I could do with removing ;) Most like putting the version number in the headers since it's stored as a class constant of Swift itself. Including the Swift.php file will solve that problem either way, but I agree that behaviour has crept in somewere along the way.
Post Reply