From 8a67529d0358af8b1c72f53c2ca6441c75be836d Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Thu, 30 Nov 2017 11:30:10 +0100 Subject: Added sending e-mails test. --- .idea/php.xml | 2 +- .idea/pollution-sensor.iml | 94 --------- .idea/workspace.xml | 272 +++++++++++++++++++------ app/Resources/views/emails/registration.php | 6 + app/config/config.yml | 2 +- app/config/parameters.yml.dist | 19 -- src/AppBundle/Controller/NewDataController.php | 36 +++- 7 files changed, 255 insertions(+), 176 deletions(-) create mode 100644 app/Resources/views/emails/registration.php delete mode 100644 app/config/parameters.yml.dist diff --git a/.idea/php.xml b/.idea/php.xml index 50580b1..10d798a 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -42,5 +42,5 @@ - + \ No newline at end of file diff --git a/.idea/pollution-sensor.iml b/.idea/pollution-sensor.iml index bf2d349..2df1551 100644 --- a/.idea/pollution-sensor.iml +++ b/.idea/pollution-sensor.iml @@ -45,99 +45,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2cf848a..99597d9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,13 @@ - + + + + + + + @@ -114,7 +152,7 @@ true DEFINITION_ORDER - + @@ -178,38 +216,52 @@ + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + - - + + - - + + @@ -219,13 +271,12 @@ - - + - - + - + - - + + - - + + @@ -305,6 +358,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -328,7 +473,6 @@ - @@ -344,7 +488,6 @@ - @@ -352,7 +495,6 @@ - @@ -360,7 +502,6 @@ - @@ -368,7 +509,6 @@ - @@ -398,7 +538,6 @@ - @@ -406,7 +545,6 @@ - @@ -414,29 +552,20 @@ - - - - - - - - - + - - + @@ -454,14 +583,29 @@ + + + + + + + + + + + + + + + - - + + @@ -471,8 +615,8 @@ - - + + @@ -480,18 +624,26 @@ - + - - + + - + - - + + + + + + + + + + diff --git a/app/Resources/views/emails/registration.php b/app/Resources/views/emails/registration.php new file mode 100644 index 0000000..c2ac995 --- /dev/null +++ b/app/Resources/views/emails/registration.php @@ -0,0 +1,6 @@ +{# app/Resources/views/Emails/registration.html.twig #} +

You did it! You registered!

+ +Hi {{ name }}! You're successfully registered. + +Thanks! \ No newline at end of file diff --git a/app/config/config.yml b/app/config/config.yml index 1a5c147..4819c20 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -51,7 +51,7 @@ doctrine: # if using pdo_sqlite as your database driver: # 1. add the path in parameters.yml # e.g. database_path: '%kernel.project_dir%/var/data/data.sqlite' - # 2. Uncomment database_path in parameters.yml.dist + # 2. Uncomment database_path in parameters.yml # 3. Uncomment next line: #path: '%database_path%' diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist deleted file mode 100644 index 2c20ddc..0000000 --- a/app/config/parameters.yml.dist +++ /dev/null @@ -1,19 +0,0 @@ -# This file is a "template" of what your parameters.yml file should look like -# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production. -# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration -parameters: - database_host: 127.0.0.1 - database_port: ~ - database_name: symfony - database_user: root - database_password: ~ - # You should uncomment this if you want to use pdo_sqlite - #database_path: '%kernel.project_dir%/var/data/data.sqlite' - - mailer_transport: smtp - mailer_host: 127.0.0.1 - mailer_user: ~ - mailer_password: ~ - - # A secret key that's used to generate certain security-related tokens - secret: ThisTokenIsNotSoSecretChangeIt diff --git a/src/AppBundle/Controller/NewDataController.php b/src/AppBundle/Controller/NewDataController.php index 2e083d9..b6ed181 100644 --- a/src/AppBundle/Controller/NewDataController.php +++ b/src/AppBundle/Controller/NewDataController.php @@ -12,7 +12,6 @@ use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Component\HttpFoundation\Response; use Symfony\Bundle\FrameworkBundle\Controller\Controller; - class NewDataController extends Controller { /** @@ -38,8 +37,43 @@ class NewDataController extends Controller $response = new Response($data); $response->headers->set('Content-Type', 'application/json'); + $this->sendEmail("Marcin"); + return $response; } + public function sendEmail($name) + { + $message = (new \Swift_Message('Hello Email')) + ->setFrom('***REMOVED***') + ->setTo('***REMOVED***@edu.easj.dk') + ->setBody( + $this->renderView( + // app/Resources/views/Emails/registration.html.twig + 'Emails/registration.html.twig', + array('name' => $name) + ), + 'text/html' + ) + /* + * If you also want to include a plaintext version of the message + ->addPart( + $this->renderView( + 'Emails/registration.txt.twig', + array('name' => $name) + ), + 'text/plain' + ) + */ + ; + + //$mailer->send($message); + + // or, you can also fetch the mailer service this way + $this->get('mailer')->send($message); + + return $this->render(...); + } + } -- cgit v1.2.3 From ee918d58e4d47618a5ff7017d94839082c1455f5 Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Thu, 30 Nov 2017 12:15:20 +0100 Subject: Add files via upload --- app/config/parameters.yml.dist | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 app/config/parameters.yml.dist diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist new file mode 100644 index 0000000..2c20ddc --- /dev/null +++ b/app/config/parameters.yml.dist @@ -0,0 +1,19 @@ +# This file is a "template" of what your parameters.yml file should look like +# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production. +# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration +parameters: + database_host: 127.0.0.1 + database_port: ~ + database_name: symfony + database_user: root + database_password: ~ + # You should uncomment this if you want to use pdo_sqlite + #database_path: '%kernel.project_dir%/var/data/data.sqlite' + + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: ~ + mailer_password: ~ + + # A secret key that's used to generate certain security-related tokens + secret: ThisTokenIsNotSoSecretChangeIt -- cgit v1.2.3 From 935088c62c7db412d8db6d26da5ac7728e9bef5c Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Thu, 30 Nov 2017 12:23:30 +0100 Subject: Added parameters back. --- .idea/workspace.xml | 390 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 329 insertions(+), 61 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2cf848a..3d42de0 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,7 @@ - + @@ -178,38 +221,52 @@ + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + - - + + - - + + @@ -219,7 +276,6 @@ -
@@ -267,37 +323,80 @@ - - + - + - + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -320,7 +577,9 @@ - + + + @@ -328,7 +587,6 @@ - @@ -344,7 +602,6 @@ - @@ -352,7 +609,6 @@ - @@ -360,7 +616,6 @@ - @@ -368,7 +623,6 @@ - @@ -398,7 +652,6 @@ - @@ -406,7 +659,6 @@ - @@ -414,29 +666,20 @@ - - - - - - - - - + - - + @@ -446,7 +689,6 @@ - @@ -460,8 +702,8 @@ - - + + @@ -469,10 +711,28 @@ + + + + + + + + + + + + + + + + + + - - + + @@ -480,18 +740,26 @@ - + - - + + - + - - + + + + + + + + + + -- cgit v1.2.3 From 95fb7632097688e535f42035ef402c81a941f73a Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Thu, 30 Nov 2017 12:25:12 +0100 Subject: Add files via upload --- app/config/parameters.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/config/parameters.yml diff --git a/app/config/parameters.yml b/app/config/parameters.yml new file mode 100644 index 0000000..3651354 --- /dev/null +++ b/app/config/parameters.yml @@ -0,0 +1,20 @@ +# This file is a "template" of what your parameters.yml file should look like +# Set parameters here that may be different on each deployment target of the app, e.g. development, staging, production. +# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration +parameters: + database_host: 127.0.0.1 + database_port: ~ + database_name: symfony + database_user: root + database_password: ~ + # You should uncomment this if you want to use pdo_sqlite + #database_path: '%kernel.project_dir%/var/data/data.sqlite' + + # Mail settings + mailer_transport: smtp + mailer_host: mail.cock.li:587 + mailer_user: ***REMOVED*** + mailer_password: ***REMOVED*** + + # A secret key that's used to generate certain security-related tokens + secret: ThisTokenIsNotSoSecretChangeIt \ No newline at end of file -- cgit v1.2.3 From 44b3568c7c21cceac34020e21000a2d30fa03ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adnan=20=C3=9Cnal?= Date: Thu, 30 Nov 2017 12:37:26 +0100 Subject: Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2f75ca1..eaac344 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ !var/SymfonyRequirements.php /vendor/ /web/bundles/ +/.idea/ -- cgit v1.2.3 From 8a6064b72e36e97dd17f7d5b4efb1b23c0844a86 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Thu, 30 Nov 2017 12:45:39 +0100 Subject: Added email controller. --- src/AppBundle/Controller/EmailController.php | 49 ++++++++++++++++++++++++++ src/AppBundle/Controller/NewDataController.php | 35 ------------------ 2 files changed, 49 insertions(+), 35 deletions(-) create mode 100644 src/AppBundle/Controller/EmailController.php diff --git a/src/AppBundle/Controller/EmailController.php b/src/AppBundle/Controller/EmailController.php new file mode 100644 index 0000000..6d78105 --- /dev/null +++ b/src/AppBundle/Controller/EmailController.php @@ -0,0 +1,49 @@ +setFrom('***REMOVED***') + ->setTo('***REMOVED***@edu.easj.dk') + ->setBody( + $this->renderView( +// app/Resources/views/Emails/registration.html.twig + 'Emails/registration.html.twig', + array('name' => "Test") + ), + 'text/html' + )/* +* If you also want to include a plaintext version of the message +->addPart( +$this->renderView( +'Emails/registration.txt.twig', +array('name' => $name) +), +'text/plain' +) +*/ + ; + +//$mailer->send($message); + +// or, you can also fetch the mailer service this way + $this->get('mailer')->send($message); + } +} \ No newline at end of file diff --git a/src/AppBundle/Controller/NewDataController.php b/src/AppBundle/Controller/NewDataController.php index b6ed181..f63a7fa 100644 --- a/src/AppBundle/Controller/NewDataController.php +++ b/src/AppBundle/Controller/NewDataController.php @@ -37,43 +37,8 @@ class NewDataController extends Controller $response = new Response($data); $response->headers->set('Content-Type', 'application/json'); - $this->sendEmail("Marcin"); - return $response; } - public function sendEmail($name) - { - $message = (new \Swift_Message('Hello Email')) - ->setFrom('***REMOVED***') - ->setTo('***REMOVED***@edu.easj.dk') - ->setBody( - $this->renderView( - // app/Resources/views/Emails/registration.html.twig - 'Emails/registration.html.twig', - array('name' => $name) - ), - 'text/html' - ) - /* - * If you also want to include a plaintext version of the message - ->addPart( - $this->renderView( - 'Emails/registration.txt.twig', - array('name' => $name) - ), - 'text/plain' - ) - */ - ; - - //$mailer->send($message); - - // or, you can also fetch the mailer service this way - $this->get('mailer')->send($message); - - return $this->render(...); - } - } -- cgit v1.2.3 From 3ece21832e7f2ebe3be8fd25bc919106df9a4106 Mon Sep 17 00:00:00 2001 From: marcinzelent Date: Thu, 30 Nov 2017 12:46:20 +0100 Subject: Merge. --- .idea/workspace.xml | 140 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 57 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3d42de0..47cda54 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -20,8 +20,8 @@ - - + + @@ -30,11 +30,34 @@ + + + + + + + + + + - - + + + + + + + + + + + + + + + @@ -53,7 +76,7 @@ - + @@ -73,16 +96,6 @@ - - - - - - - - - - @@ -145,9 +158,10 @@ @@ -320,21 +334,28 @@ + + 1512042339566 + +
- - - + @@ -395,7 +416,8 @@ @@ -404,14 +426,6 @@ - - - - - - - - @@ -685,13 +699,6 @@ - - - - - - - @@ -700,17 +707,6 @@ - - - - - - - - - - - @@ -729,17 +725,6 @@ - - - - - - - - - - - @@ -764,5 +749,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3