Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos-tav
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
agplv3
kohinos-tav
Commits
bfb41bd6
Commit
bfb41bd6
authored
Mar 03, 2022
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config email : testemail route + remove spool memory
parent
2b18f811
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
swiftmailer.yaml
config/packages/swiftmailer.yaml
+2
-2
MailerController.php
src/Controller/MailerController.php
+43
-0
No files found.
config/packages/swiftmailer.yaml
View file @
bfb41bd6
swiftmailer
:
swiftmailer
:
url
:
'
%env(MAILER_URL)%'
url
:
'
%env(MAILER_URL)%'
spool
:
{
type
:
'
memory'
}
\ No newline at end of file
src/Controller/MailerController.php
0 → 100644
View file @
bfb41bd6
<?php
namespace
App\Controller
;
use
App\Entity\Adherent
;
use
App\Entity\GlobalParameter
;
use
App\Entity\Payment
;
use
App\Form\Type\AdhererFormType
;
use
App\Utils\CustomEntityManager
;
use
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\Routing\Annotation\Route
;
use
Symfony\Component\Serializer\Normalizer\AbstractNormalizer
;
class
MailerController
extends
AbstractController
{
private
$em
;
private
$mailer
;
public
function
__construct
(
CustomEntityManager
$em
,
\Swift_Mailer
$mailer
)
{
$this
->
em
=
$em
;
$this
->
mailer
=
$mailer
;
}
/**
* @Route("/testmail",name="testmail")
*/
public
function
sendEmail
()
{
$email
=
(
new
\Swift_Message
(
'Message de test Kohinos'
))
->
setFrom
(
$this
->
em
->
getRepository
(
GlobalParameter
::
class
)
->
val
(
GlobalParameter
::
MLC_NOTIF_EMAIL
))
->
setTo
(
'julien.jorry@gmail.com'
)
->
setCharset
(
'utf-8'
)
->
setBody
(
'Hello from symfony!'
);
$sentEmail
=
$this
->
mailer
->
send
(
$email
);
dump
(
$sentEmail
);
return
$this
->
redirectToRoute
(
'index'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment