0

I want to send an email with Symfony SwiftMail and a Gandi (roundcube) adress. The problem is that nothing happen and I don't know why. ^^

config.yml

swiftmailer:
    transport: mail
    encryption: ssl
    auth_mode:  login
    host:      smtp
    username:  'my email'
    password:  'my mdp'

parametres.yml

parameters:
    mailer_transport: smtp
    mailer_host: 127.0.0.1:160
    mailer_user: null
    mailer_password: null

Controller:

public function contactAction()
{
    $mail = "mymail";
    $enquiry = new Contact();
    $form = $this->createForm(new EnquiryType(), $enquiry);

    $request = $this->getRequest();
    if ($request->getMethod() == 'POST')
    {
        $form->bind($request);
        $data = $form->getData();

        $message = \Swift_Message::newInstance()
            ->setContentType('text/html')
            ->setSubject($data->getSubject())
            ->setFrom($data->getAdresse())
            ->setTo($mail)
            ->setBody($data->getMessage());
        $this->get('mailer')->send($message);

        return $this->redirect($this->generateUrl('st_contact_homepage'));
    }
    return $this->render('STCommonBundle:Default:contact.html.twig', array('form' => $form->createView()));
}

Can you help me please?

Thanks. ^^

Valentin BEAULE
  • 384
  • 1
  • 7
  • 26

1 Answers1

0

your config seems to be wrong

the "host" property must be the smpt hostname

sth like

smpt.yahoo.com

you need to find it out

and the transport is smpt

so rather like that :

swiftmailer:
    transport: smtp
    encryption: ssl
    auth_mode:  login
    host:      smtp.yahoo.com
    username:  'my email'
    password:  'my mdp'
john Smith
  • 17,409
  • 11
  • 76
  • 117
  • Hi, thank for the reply, I've been able to work this with your advice. My misstake was to use a generic host, not the one from the service (yahoo/google/...). – Valentin BEAULE Dec 07 '15 at 12:43