Skip to content
Snippets Groups Projects
Commit 6950f160 authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT
Browse files

hotline#123836 : mail subject of sent answers from forms are customized by form

parent ee823e7f
Branches
Tags
No related merge requests found
Pipeline #11950 passed with stage
in 52 minutes and 13 seconds
- ticket #123836 : Pouvoir personnaliser l'objet des mails envoyés par formulaire
\ No newline at end of file
......@@ -46,17 +46,19 @@ class FormulaireController extends ZendAfi_Controller_Action {
$this->view->article = $article;
if ($address = $article->getDestinationEmail()) {
$this->_sendFormEmail($address, $formulaire->dataAsBodyText());
$this->_sendFormEmail($address, $formulaire->dataAsBodyText(), $article->getTitre());
$this->view->email_sent = true;
}
}
protected function _sendFormEmail($address, $body) {
protected function _sendFormEmail($address, $body, $subject = "") {
$mail = new ZendAfi_Mail('utf8');
$mail->setFrom(Class_Profil::getCurrentProfil()->getMailSiteOrPortail())
->addTo($address)
->setSubject('[Bokeh] ' . $this->_('Envoi d\'un formulaire'))
->setSubject('[Bokeh] ' . ($subject
? $this->_('Réponse formulaire : ').$subject
: $this->_('Envoi d\'un formulaire')))
->setBodyText($body);
$this->_sendMail($mail);
......
......@@ -104,7 +104,7 @@ class FormulaireControllerWithEmailPostActionTest extends FormulaireControllerPo
/** @test */
public function emailSubjectShouldBeFormSent() {
$this->assertEquals('[Bokeh] Envoi d\'un formulaire', $this->mock_transport->getSentMails()[0]->getSubject());
$this->assertContains('[Bokeh] Réponse formulaire : Contactez nous', quoted_printable_decode($this->mock_transport->getSentMails()[0]->getSubject()));
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment