Swift_TransportException'与消息'无法与主机建立连接[操作超时#60]


Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host [Operation timed out #60]

我使用的是Silex SwiftmailerServiceProvider。现在我需要从我的网站发送电子邮件,但我一直得到这个错误。我找遍了所有的地方,但我只找到#110错误等。

我现在使用的代码:

$message = 'Swift_Message::newInstance()
            ->setSubject('[OFFERTE]' . $data['name'])
            ->setFrom(array('fromemail'))
            ->setTo(array('myemail'))
            ->setBody($data['comment'],'text/html');
$app['mailer']->send($message);

上面的代码是my page.php(登陆页)中的代码。

$app->register(new Silex'Provider'SwiftmailerServiceProvider(), array(
'swiftmailer.options' => array(
    'host' => 'host',
    'port' => 'port',
    'username' => 'username',
    'password' => 'password',
    'encryption' => null,
    'auth_mode' => null
)
));

上面的代码是我的bootstrap.php中的代码(如果你熟悉silex)。有人知道这个错误的来源是什么吗?

谢谢!

Pieter-Jan

编辑:我没有在boostrap.php中填写host etc

对于所有有同样问题的人,我有…

如果你得到这个消息,你做错了什么。我遇到的问题是,一些数据是错误的,使连接。