documentation
This commit is contained in:
parent
76fc84daae
commit
341bfa1622
@ -4,6 +4,9 @@ class Mail
|
||||
protected $config;
|
||||
protected $mail;
|
||||
|
||||
/**
|
||||
* Gestion de l'envoi des mails en fonction de la configuration
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/configuration.ini', 'mail');
|
||||
@ -17,38 +20,66 @@ class Mail
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Champ From en fonction de la clé de configuration (configuration.ini)
|
||||
* @param string $configKey
|
||||
*/
|
||||
public function setFrom($configKey)
|
||||
{
|
||||
$email = $this->config->$configKey;
|
||||
$this->mail->setFrom($email, ucfirst($configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* Champ To en fonction de la clé de configuration (configuration.ini)
|
||||
* @param string $configKey
|
||||
*/
|
||||
public function addToKey($configKey)
|
||||
{
|
||||
$email = $this->config->$configKey;
|
||||
$this->mail->addTo($email, ucfirst($configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajout d'un champ To en spécifiant l'email et le nom qui doit apparaitre
|
||||
* @param string $email
|
||||
* @param string $nom
|
||||
*/
|
||||
public function addTo($email, $nom = '')
|
||||
{
|
||||
$this->mail->addTo($email, $this->txtConvert($nom));
|
||||
}
|
||||
|
||||
/**
|
||||
* Définit le sujet de l'email
|
||||
* @param string $texte
|
||||
*/
|
||||
public function setSubject($texte = '')
|
||||
{
|
||||
$this->mail->setSubject($this->txtConvert($texte));
|
||||
}
|
||||
|
||||
/**
|
||||
* Définit le corps de l'email au format texte
|
||||
* @param string $texte
|
||||
*/
|
||||
public function setBodyTexte($texte = '')
|
||||
{
|
||||
$this->mail->setBodyText($this->txtConvert($texte));
|
||||
}
|
||||
|
||||
/**
|
||||
* Définit le corps de l'email au format html
|
||||
* @param string $html
|
||||
*/
|
||||
public function setBodyHtml($html = '')
|
||||
{
|
||||
$this->mail->setBodyHtml($this->txtConvert($html));
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoi de l'emai
|
||||
*/
|
||||
public function send()
|
||||
{
|
||||
$this->mail->send();
|
||||
|
Loading…
Reference in New Issue
Block a user