Ajout la possibilité de configurer l'envoi de mail

This commit is contained in:
Michael RICOIS 2015-06-17 15:06:49 +00:00
parent da3836d96e
commit 1d4a18065b
4 changed files with 69 additions and 6 deletions

View File

@ -133,10 +133,30 @@ if ( isset($opts->file) )
$txt.= "Taille du fichier : $size\n";
$mail = new Zend_Mail('UTF-8');
$tr = new Zend_Mail_Transport_Smtp('smtp.celeste.fr');
// --- Configuration du transport SMTP
if ( $c->profil->mail->method == 'smtp' ) {
$config = array();
if ( isset($this->config->auth) ) {
$config['auth'] = $this->config->auth;
if ( isset($this->config->username) ) {
$config['username'] = $c->profil->mail->username;
}
if ( isset($this->config->password) ) {
$config['password'] = $c->profil->mail->password;
}
}
if ( isset($this->config->port) ) {
$config['port'] = $c->profil->mail->port;
}
$tr = new Zend_Mail_Transport_Smtp($c->profil->mail->host, $config);
}
// --- Configuration transport Sendmail
if ( $this->config->mail->method == 'sendmail' ) {
$tr = new Zend_Mail_Transport_Sendmail();
}
$mail->setDefaultTransport($tr);
$mail->setBodyText($txt);
$mail->setFrom('supportdev@scores-decisions.com', 'Machine');
$mail->setFrom('supportdev@scores-decisions.com', 'Machine Flux');
$mail->addTo('suivi@scores-decisions.com', 'Suivi');
$mail->setSubject($subject);
$mail->send();

View File

@ -174,10 +174,30 @@ if ( $result->count() > 0 ) {
$txt.= "Nombre de Lignes : $nbLines\n";
$mail = new Zend_Mail('UTF-8');
$tr = new Zend_Mail_Transport_Sendmail();
// --- Configuration du transport SMTP
if ( $c->profil->mail->method == 'smtp' ) {
$config = array();
if ( isset($this->config->auth) ) {
$config['auth'] = $this->config->auth;
if ( isset($this->config->username) ) {
$config['username'] = $c->profil->mail->username;
}
if ( isset($this->config->password) ) {
$config['password'] = $c->profil->mail->password;
}
}
if ( isset($this->config->port) ) {
$config['port'] = $c->profil->mail->port;
}
$tr = new Zend_Mail_Transport_Smtp($c->profil->mail->host, $config);
}
// --- Configuration transport Sendmail
if ( $this->config->mail->method == 'sendmail' ) {
$tr = new Zend_Mail_Transport_Sendmail();
}
$mail->setDefaultTransport($tr);
$mail->setBodyText($txt);
$mail->setFrom('supportdev@scores-decisions.com', 'Machine');
$mail->setFrom('supportdev@scores-decisions.com', 'Machine Flux');
$mail->addTo('suivi@scores-decisions.com', 'Suivi');
$mail->setSubject($subject);
$mail->send();

View File

@ -210,10 +210,30 @@ if ( isset($opts->file) )
$txt.= "Taille du fichier : $size\n";
$mail = new Zend_Mail('UTF-8');
$tr = new Zend_Mail_Transport_Smtp('smtp.celeste.fr');
// --- Configuration du transport SMTP
if ( $c->profil->mail->method == 'smtp' ) {
$config = array();
if ( isset($this->config->auth) ) {
$config['auth'] = $this->config->auth;
if ( isset($this->config->username) ) {
$config['username'] = $c->profil->mail->username;
}
if ( isset($this->config->password) ) {
$config['password'] = $c->profil->mail->password;
}
}
if ( isset($this->config->port) ) {
$config['port'] = $c->profil->mail->port;
}
$tr = new Zend_Mail_Transport_Smtp($c->profil->mail->host, $config);
}
// --- Configuration transport Sendmail
if ( $this->config->mail->method == 'sendmail' ) {
$tr = new Zend_Mail_Transport_Sendmail();
}
$mail->setDefaultTransport($tr);
$mail->setBodyText($txt);
$mail->setFrom('supportdev@scores-decisions.com', 'Machine');
$mail->setFrom('supportdev@scores-decisions.com', 'Machine Flux');
$mail->addTo('suivi@scores-decisions.com', 'Suivi');
$mail->setSubject($subject);
$mail->send();

View File

@ -27,6 +27,9 @@ profil.db.metier.params.password=2XQTpKatBVRezXE9
profil.db.metier.params.dbname=sdv1
profil.db.metier.params.driver_options.MYSQLI_INIT_COMMAND = "SET NAMES utf8"
; Mail configuration
profil.db.method = sendmail
[staging : production]
resources.frontController.params.displayExceptions = 1