diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 0a846c8f6..3c2224b2c 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -7,8 +7,8 @@ parameters: database_name: symfony database_user: root database_password: ~ - - slack_url: "" + # You should uncomment this if you want use pdo_sqlite + # database_path: "%kernel.root_dir%/data.db3" # A secret key that's used to generate certain security-related tokens secret: ThisTokenIsNotSoSecretChangeIt @@ -23,6 +23,9 @@ parameters: home_algolia_enabled: false + # Slack url for notifications + slack_url: 'http://yolo' + twitter_oauth_access_token: "" twitter_oauth_access_token_secret: "" twitter_consumer_key: "" @@ -69,3 +72,11 @@ parameters: paybox_identifiant: "110647233" blog_api_key: 123456 + + mails_serveur_smtp: "mailcatcher" + mails_tls: 0 + mails_username: "" + mails_password: "" + mails_port: 1025 + mails_force_destinataire: [] + mails_bcc: [] \ No newline at end of file diff --git a/app/config/parameters.yml.dist-docker b/app/config/parameters.yml.dist-docker index 333c70368..24aaba5b7 100644 --- a/app/config/parameters.yml.dist-docker +++ b/app/config/parameters.yml.dist-docker @@ -72,3 +72,11 @@ parameters: paybox_identifiant: "110647233" blog_api_key: 123456 + + mails_serveur_smtp: "mailcatcher" + mails_tls: 0 + mails_username: "" + mails_password: "" + mails_port: 1025 + mails_force_destinataire: [] + mails_bcc: [] \ No newline at end of file diff --git a/configs/application/config-test.php b/configs/application/config-test.php index 501f009c5..ede46aee4 100644 --- a/configs/application/config-test.php +++ b/configs/application/config-test.php @@ -1,15 +1,6 @@ obtenir('mails|email_expediteur'); - $ok = Mailing::envoyerMail(new Message($sujet, new MailUser($expediteur), MailUserFactory::tresorier()), $corps); + $ok = Mailing::envoyerMail(new Message($sujet, new MailUser(Mailing::EMAIL_EXPEDITEUR, Mailing::NOM_EXPEDITEUR), MailUserFactory::tresorier()), $corps); if (false === $ok) { return false; diff --git a/sources/Afup/Comptabilite/Facture.php b/sources/Afup/Comptabilite/Facture.php index 451f11297..ebda9931d 100644 --- a/sources/Afup/Comptabilite/Facture.php +++ b/sources/Afup/Comptabilite/Facture.php @@ -3,6 +3,7 @@ namespace Afup\Site\Comptabilite; +use Afup\Site\Utils\Mail; use Afup\Site\Utils\Mailing; use Afup\Site\Utils\Pays; use Afup\Site\Utils\PDF_Facture; @@ -735,8 +736,7 @@ function envoyerFacture($reference) $chemin_facture = AFUP_CHEMIN_RACINE . 'cache' . DIRECTORY_SEPARATOR . 'fact' . $reference . '.pdf'; $this->genererFacture($reference, $chemin_facture); - $expediteur = $GLOBALS['AFUP_CONF']->obtenir('mails|email_expediteur'); - $message = new Message($sujet, new MailUser($expediteur), new MailUser($personne['email'], $personne['nom'])); + $message = new Message($sujet, new MailUser(Mailing::EMAIL_EXPEDITEUR, Mailing::NOM_EXPEDITEUR), new MailUser($personne['email'], $personne['nom'])); $message->addAttachment(new Attachment( $chemin_facture, 'facture-'.$reference.'.pdf', diff --git a/sources/Afup/Utils/Configuration.php b/sources/Afup/Utils/Configuration.php index 606fd894f..0e78803d7 100644 --- a/sources/Afup/Utils/Configuration.php +++ b/sources/Afup/Utils/Configuration.php @@ -45,6 +45,15 @@ public function __construct($chemin_fichier) $this->_valeurs['bdd']['base'] = $parameters['database_name']; $this->_valeurs['bdd']['utilisateur'] = $parameters['database_user']; $this->_valeurs['bdd']['mot_de_passe'] = $parameters['database_password']; + + $this->_valeurs['mails']['serveur_smtp'] = $parameters['mails_serveur_smtp']; + $this->_valeurs['mails']['tls'] = $parameters['mails_tls']; + $this->_valeurs['mails']['username'] = $parameters['mails_username']; + $this->_valeurs['mails']['password'] = $parameters['mails_password']; + $this->_valeurs['mails']['port'] = $parameters['mails_port']; + + $this->_valeurs['mails']['force_destinataire'] = $parameters['mails_force_destinataire']; + $this->_valeurs['mails']['bcc'] = $parameters['mails_bcc']; } } diff --git a/sources/Afup/Utils/Mailing.php b/sources/Afup/Utils/Mailing.php index ed33b8412..a9f4148bb 100644 --- a/sources/Afup/Utils/Mailing.php +++ b/sources/Afup/Utils/Mailing.php @@ -6,6 +6,9 @@ class Mailing { + const EMAIL_EXPEDITEUR = 'bureau@afup.org'; + const NOM_EXPEDITEUR = 'Bureau AFUP'; + /** * @param Message $message * @param string $body diff --git a/sources/AppBundle/Association/UserMembership/UserService.php b/sources/AppBundle/Association/UserMembership/UserService.php index 7f48da6e4..4afb2a270 100644 --- a/sources/AppBundle/Association/UserMembership/UserService.php +++ b/sources/AppBundle/Association/UserMembership/UserService.php @@ -3,7 +3,7 @@ namespace AppBundle\Association\UserMembership; use Afup\Site\Association\Cotisations; -use Afup\Site\Utils\Configuration; +use Afup\Site\Utils\Mailing; use AppBundle\Association\Model\Repository\UserRepository; use AppBundle\Association\Model\User; use AppBundle\Email\Mailer\Mailer; @@ -29,14 +29,13 @@ public function __construct( UserRepository $userRepository, Mailer $mailer, UrlGeneratorInterface $urlGenerator, - Configuration $configuration, Cotisations $cotisations ) { $this->userRepository = $userRepository; $this->mailer = $mailer; $this->urlGenerator = $urlGenerator; $this->cotisations = $cotisations; - $this->sender = $configuration->obtenir('mails|email_expediteur'); + $this->sender = Mailing::EMAIL_EXPEDITEUR; } public function generateRandomPassword()