| Line 186... |
Line 186... |
| 186 |
* @param string $expediteur l'expediteur du message
|
186 |
* @param string $expediteur l'expediteur du message
|
| 187 |
* @param mixed $destinataires un string ou un tableau de mails qui contiennent les destinataire
|
187 |
* @param mixed $destinataires un string ou un tableau de mails qui contiennent les destinataire
|
| 188 |
* @param string $sujet sujet du mail
|
188 |
* @param string $sujet sujet du mail
|
| 189 |
* @return boolean true ou false suivant le succès ou non de l'envoi
|
189 |
* @return boolean true ou false suivant le succès ou non de l'envoi
|
| 190 |
*/
|
190 |
*/
|
| 191 |
public function envoyerMailText($expediteur, $destinataires, $sujet, $message) {
|
191 |
public function envoyerMailText($expediteur, $destinataires, $sujet, $message, $adresse_reponse = null) {
|
| 192 |
if (!is_array($destinataires)) {
|
192 |
if (!is_array($destinataires)) {
|
| 193 |
$destinataires = array($destinataires);
|
193 |
$destinataires = array($destinataires);
|
| 194 |
}
|
194 |
}
|
| Line 195... |
Line 195... |
| 195 |
|
195 |
|
| Line 199... |
Line 199... |
| 199 |
"X-Mailer: PHP-ANNUAIRE-TXT\n".
|
199 |
"X-Mailer: PHP-ANNUAIRE-TXT\n".
|
| 200 |
"X-auth-smtp-user: annuaire@tela-botanica.org \n".
|
200 |
"X-auth-smtp-user: annuaire@tela-botanica.org \n".
|
| 201 |
"X-abuse-contact: annuaire@tela-botanica.org \n".
|
201 |
"X-abuse-contact: annuaire@tela-botanica.org \n".
|
| 202 |
"Date: ".date('r')."\n".
|
202 |
"Date: ".date('r')."\n".
|
| 203 |
"From: $expediteur\n".
|
203 |
"From: $expediteur\n".
|
| 204 |
'Content-Type: text/plain; charset="'.Config::get('appli_encodage').'";'."\n".
|
204 |
'Content-Type: text/plain; charset="'.Config::get('appli_encodage').'";'."\n";
|
| - |
|
205 |
if ($adresse_reponse !== null) {
|
| - |
|
206 |
$entetes .= 'Reply-To: '.$adresse_reponse."\n";
|
| - |
|
207 |
}
|
| 205 |
"Content-Transfer-Encoding: 8bit;\n\n";
|
208 |
$entetes .= "Content-Transfer-Encoding: 8bit;\n\n";
|
| Line 206... |
Line 209... |
| 206 |
|
209 |
|
| 207 |
$sujetEndode = mb_encode_mimeheader($this->encoderChainePourEnvoiMail($sujet));
|
210 |
$sujetEncode = mb_encode_mimeheader($this->encoderChainePourEnvoiMail($sujet), mb_internal_encoding(), "B", "\n");
|
| Line 208... |
Line 211... |
| 208 |
$contenu = $this->encoderChainePourEnvoiMail($message);
|
211 |
$contenu = $this->encoderChainePourEnvoiMail($message);
|
| 209 |
|
212 |
|
| 210 |
foreach ($destinataires as $destinataire) {
|
213 |
foreach ($destinataires as $destinataire) {
|
| Line 261... |
Line 264... |
| 261 |
"Content-Type: text/html; charset=\"$encodage\";".$eol.
|
264 |
"Content-Type: text/html; charset=\"$encodage\";".$eol.
|
| 262 |
"Content-Transfer-Encoding: 8bit;".$eol.$eol.
|
265 |
"Content-Transfer-Encoding: 8bit;".$eol.$eol.
|
| 263 |
$message_html.$eol.$eol.
|
266 |
$message_html.$eol.$eol.
|
| 264 |
"--$limite--".$eol.$eol;
|
267 |
"--$limite--".$eol.$eol;
|
| Line 265... |
Line 268... |
| 265 |
|
268 |
|
| 266 |
$sujetEncode = mb_encode_mimeheader($this->encoderChainePourEnvoiMail($sujet), $encodage);
|
269 |
$sujetEncode = mb_encode_mimeheader($this->encoderChainePourEnvoiMail($sujet), $encodage, "B", "\n");
|
| 267 |
$ok = true;
|
270 |
$ok = true;
|
| 268 |
foreach ($destinataires as $destinataire) {
|
271 |
foreach ($destinataires as $destinataire) {
|
| 269 |
$ok = mail($destinataire, $sujetEncode, $contenu, $entetes);
|
272 |
$ok = mail($destinataire, $sujetEncode, $contenu, $entetes);
|
| 270 |
if (!$ok) {
|
273 |
if (!$ok) {
|
| Line 335... |
Line 338... |
| 335 |
"X-Attachment-Id: ".md5($attachment)."\n\n".
|
338 |
"X-Attachment-Id: ".md5($attachment)."\n\n".
|
| 336 |
"$attachment\n".
|
339 |
"$attachment\n".
|
| 337 |
"--$limite--\n";
|
340 |
"--$limite--\n";
|
| 338 |
}
|
341 |
}
|
| Line 339... |
Line 342... |
| 339 |
|
342 |
|
| 340 |
$sujetEncode = mb_encode_mimeheader($sujet);
|
343 |
$sujetEncode = mb_encode_mimeheader($sujet, mb_internal_encoding(), "B", "\n");
|
| 341 |
foreach ($destinataires as $destinataire) {
|
344 |
foreach ($destinataires as $destinataire) {
|
| 342 |
if (!mail($destinataire, $sujetEncode, $contenu, $entetes)) {
|
345 |
if (!mail($destinataire, $sujetEncode, $contenu, $entetes)) {
|
| 343 |
return false;
|
346 |
return false;
|
| 344 |
}
|
347 |
}
|