Configuration SwiftMailer avec Gmail
Bonjour à tous, je cherche à configurer SwiftMailer avec Gmail...
J'ai mon factories.yml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| all:
mailer:
class: sfMailer
param:
logging: %SF_LOGGING_ENABLED%
charset: %SF_CHARSET%
delivery_strategy: spool
transport:
class: Swift_SmtpTransport
param:
host: smtp.gmail.com
port: 465
encryption: ssl
username: blasil64
password: mdpGm4ilSec0re |
Et mon actions.class.php du module contact :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| public function executeIndex(sfWebRequest $request)
{
$this->form = new ContactForm();
if ($request->isMethod('post')) // On vérifie que l'on a bien fait en post
{
$this->form->bind($request->getParameter($this->form->getName()));
if ($this->form->isValid()) // On va pouvoir envoyer les mails de contact
{
// On stocke mon adresse mail
$subject = sfConfig::get('app_mail_contact');
//On instancie le mail pour envoyer l'envoyer
$mail = Swift_Message::newInstance()
->setFrom(array($this->form->getValue('email') => trim(ucfirst($this->form->getValue('nom')))." ".trim(ucfirst($this->form->getValue('prenom')))))
->setTo($subject)
->setSubject($this->form->getValue('subject'))
->setBody($this->form->getValue('message'));
//Envoi des mail
$this->getMailer()->sendNextImmediately()->send($mail);
//Redirection sur la page d'accueil avec une notice
$this->getUser()->setFlash('notice', 'Votre demande de contact a bien été prise en compte.');
$this->redirect('@homepage');
}
}
} |
Mais quand je teste tout ça, j'ai une erreur :
Citation:
500 | Internal Server Error | Swift_TransportException
Connection could not be established with host smtp.gmail.com [Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP? #78857840]
Comment puis-je faire pour le faire fonctionner ?
Merci d'avance pour vos réponses !