Skip to content
Snippets Groups Projects
Commit f769d9b3 authored by llaffont's avatar llaffont
Browse files

Newsletters: correction envoi si mail invalide

parent 2ae1ea6e
Branches
Tags
No related merge requests found
......@@ -31,6 +31,13 @@ class ZendAfi_Mail extends Zend_Mail {
parent::addTo($recipient, $name);
return $this;
}
public function addBcc($email) {
$validator = new Zend_Validate_EmailAddress();
if ($validator->isValid($email))
parent::addBcc($email);
}
}
?>
\ No newline at end of file
......@@ -62,6 +62,13 @@ class NewsletterMailingAnimationsTestSendMail extends ModelTestCase {
->setMail('mduchamp@hotmail.com');
$this->zork = new Class_Users();
$this->zork
->setPrenom('')
->setNom('Zork')
->setMail('zork');
$this->animations = new Class_Newsletter();
$this->animations
->setTitre('Animations du mois')
......@@ -71,6 +78,7 @@ class NewsletterMailingAnimationsTestSendMail extends ModelTestCase {
->setIdPanier(null)
->addUser($this->rdubois)
->addUser($this->mduchamp)
->addUser($this->zork)
->setExpediteur(null);
$this->mock_transport = new MockMailTransport();
......@@ -103,6 +111,13 @@ class NewsletterMailingAnimationsTestSendMail extends ModelTestCase {
$this->mail->getRecipients());
}
public function testBccShouldNotIncludeZork() {
$this->assertNotContains('zork',
$this->mail->getRecipients());
}
public function testToIsAdminPortail() {
$this->assertContains('flo@astrolabe.fr',
$this->mail->getRecipients());
......
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