diff --git a/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php b/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php
index eae01bba57..571a74e820 100644
--- a/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php
+++ b/src/Symfony/Framework/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php
@@ -52,6 +52,9 @@ class SwiftMailerExtension extends LoaderExtension
$configuration->setAlias('mailer', 'swiftmailer.mailer');
}
+ $r = new \ReflectionClass('Swift_Message');
+ $configuration->setParameter('swiftmailer.base_dir', dirname(dirname(dirname($r->getFilename()))));
+
$transport = $configuration->getParameter('swiftmailer.transport.name');
if (array_key_exists('transport', $config)) {
if (null === $config['transport']) {
diff --git a/src/Symfony/Framework/SwiftmailerBundle/Resources/config/swiftmailer.xml b/src/Symfony/Framework/SwiftmailerBundle/Resources/config/swiftmailer.xml
index e1c77e91e5..d3c2ec1c44 100644
--- a/src/Symfony/Framework/SwiftmailerBundle/Resources/config/swiftmailer.xml
+++ b/src/Symfony/Framework/SwiftmailerBundle/Resources/config/swiftmailer.xml
@@ -22,7 +22,7 @@
Swift_Transport_FailoverTransport
Swift_FileSpool
- swift_init.php
+ %swiftmailer.base_dir%/swift_init.php
Swift_Plugins_RedirectingPlugin
Swift_Plugins_BlackholePlugin