I have a question that it is possible to send email in dev production in symfony in localhost wamp by using gmail. From template I get input value and set in controller. In congig_dev I have those swiftmailer: transport: gmail host: smtp.gmail.com username: '[email protected]' password: '****'
Below I set program from controller->
<?php
namespace PsiutekBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class BasketController extends Controller
{
public function koszykAction()
{
return $this->render('PsiutekBundle:Basket:koszyk.html.twig');
}
public function SendMailAction()
{
$Request=$this->get('request_stack')->getCurrentRequest();
if($Request->getMethod()=="POST"){
$subject=$Request->get("Subject");
print_r($subject);
exit;
$email=$Request->get("email");
$body=$Request->get("message");
print_r($body);
$transport=\Swift_SmtpTransport::newInstance('smtp.gmail.com',465,'ssl')
->setUsername('[email protected]')
->setPassword('******');
$mailer=\Swift_Mailer::newInstance($transport);
$message = \Swift_Message::newInstance('Web Lead')
->setSubject($subject)
->setTo($email)
->setBody($body);
$result=$mailer->send($message);
}
return $this->render('PsiutekBundle:Basket:koszyk.html.twig');
}
}
Symfony2
specific question - these answers are not – Tomasz Madeyski