swiftmailer发送电子邮件在Silex被拒绝

时间:2015-11-12 16:47:01

标签: php symfony email swiftmailer silex

我一直在尝试使用swiftmailer和Silex,在阅读完整的文档后,查看这里的主题并进行一些测试,我完全不知道为什么电子邮件不想发送。 为了寻找答案,我一直在使用ArrayLogger插件,它给了我一个提示:public class Causes { public string volunteer_name { get; set; } public string volunteer_cause { get; set; } public string cause_location { get; set; } public int volunteer_contact { get; set; } }

以下是我app.php的服务声明:

<< 521 Mail rejected - not allowed to receive mail from this sender

这是我的控制器:

$app->register(new Silex\Provider\SwiftmailerServiceProvider());

以下是来自Contact类的方法通知:

/**
     * Contact page controller.
     *
     * @param Application $app Silex application
     */
    public function contactAction(Request $request, Application $app) {
        $contact = new Contact();
        $contactForm = $app['form.factory']->create(new ContactType(), $contact);
        $contactForm->handleRequest($request);
        if ($contactForm->isSubmitted() && $contactForm->isValid()) {
            $contact->notify($app);
            $app['session']->getFlashBag()->add('success', 'Your message was successfully sent.');
        }
        return $app['twig']->render('contact.html.twig', array(
            'contactForm' => $contactForm->createView()));
    }

配置(电子邮件和端口)是我在我的文件php.ini中找到的信息,但由于我对这一切都不了解,我可能会在那里弄错。

1 个答案:

答案 0 :(得分:0)

您的问题似乎是邮件中继服务器问题,而不是SwiftMailer问题。检查您是否可以使用telnet使用此服务器发送电子邮件。如果你不知道如何做到这一点,请看看这里: http://ubuntuwiki.net/index.php/SMTP,_testing_via_Telnet