test mail route

This commit is contained in:
Kayn Ty 2018-05-14 13:15:45 +02:00
parent a9755e1a03
commit e6f78e9541
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,7 @@
{% extends 'base.html.twig' %}
{% block bigMain %}
<h1>tadam test de mail</h1>
le contenu
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus doloremque exercitationem provident quae quod soluta sunt velit. Architecto, assumenda deserunt expedita laudantium nemo voluptatem. Atque commodi est iste itaque mollitia. Consequatur cumque cupiditate eveniet facilis illo illum impedit itaque omnis placeat quaerat, quia quidem ratione saepe similique sunt veniam veritatis.
{% endblock %}

View File

@ -50,3 +50,7 @@ add_selling:
fos_user: fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml" resource: "@FOSUserBundle/Resources/config/routing/all.xml"
# emails
tktest_mail:
path: /test-email
defaults: { _controller: AppBundle:Default:email }

View File

@ -73,6 +73,28 @@ class DefaultController extends Controller {
] ); ] );
} }
/**
* envoyer un email
*/
public function emailAction() {
$name = "noble barbare";
$message = \Swift_Message::newInstance()
->setSubject( 'Hello Email' )
->setFrom( 'test-symfony-tykayn@meluzine.org' )
->setTo( 'tykayn@gmail.com' )
->setBody( $this->renderView( 'default/test-email.html.twig',
[ 'name' => $name ] ) );
$this->get( 'mailer' )->send( $message );
//return 'yay test de mail';
return $this->render(
'default/test-email.html.twig',
[
]
);
}
/** /**
* get user products * get user products
* @return JsonResponse * @return JsonResponse