/** * Envoie de mail sur l'evolution des données de la transactions depuis Arcadia * @param string $paramSujet * @param string $paramCorpMail * @param string $paramArdTto * @param string $paramArdFrom * @param string $paramUrlSmtp * @return string */ function sendMail($paramSujet, $paramCorpMail, $paramArdTto, $paramArdFrom, $paramUrlSmtp) { //Création du mail $mail = new htmlMimeMail5(); // $mail->setSMTPParams($paramUrlSmtp); // Set the From and Reply-To headers $mail->setFrom($paramArdFrom); $mail->setReturnPath($paramArdFrom); // Set the Subject $mail->setSubject($paramSujet); /** * Encodement en utf-8 */ $mail->setTextCharset("UTF-8"); $mail->setHTMLCharset("UTF-8"); $mail->setHeadCharset("UTF-8"); // Set the body $mail->setHTML(nl2br($paramCorpMail)); /** * L'envoi réel du mail n'est pas réalisé en environnement Codeur */ $result = $mail->send(array($paramArdTto), 'smtp'); return $result; }
function envoismail($sujetmail, $text, $destinataire, $expediteur, $paramTypeMail = null, $conf = null) { if ($conf == null) { $globalConfig = new GlobalConfig(); } if ($globalConfig->getConf()->getSmtpServiceEnable() == TRUE) { /* * Toutes les adresses emails sont redirigées vers utilisateurs.fta@ldc.fr * Si la redirection est mis en place */ if ($globalConfig->getConf()->getSmtpEmailRedirectionUser()) { $destinataire_orig = $destinataire; $destinataire = $globalConfig->getConf()->getSmtpEmailRedirectionUser(); $sujetmail_orig = $sujetmail; $sujetmail = "[Environnement " . $globalConfig->getConf()->getExecEnvironment() . "] " . $sujetmail_orig; $text_orig = $text; if (is_array($destinataire_orig)) { $listeDesDestinataire = explode(",", $destinataire_orig); } else { $listeDesDestinataire = $destinataire_orig; } $text = $listeDesDestinataire . "\n" . $text_orig; } //Création du mail $mail = new htmlMimeMail5(); $mail->setSMTPParams($globalConfig->getConf()->getSmtpServerName()); // Set the From and Reply-To headers $mail->setFrom($expediteur); $mail->setReturnPath($expediteur); // Set the Subject $mail->setSubject($sujetmail); /** * Encodement en utf-8 */ $mail->setTextCharset("UTF-8"); $mail->setHTMLCharset("UTF-8"); $mail->setHeadCharset("UTF-8"); // Set the body $mail->setHTML(nl2br($text)); //$result = $mail->send(array($adresse_to), 'smtp'); //$result = $mail->send(array($destinataire), 'smtp'); /** * L'envoi réel du mail n'est pas réalisé en environnement Codeur */ if ($paramTypeMail != "mail-transactions") { $result = $mail->send(array($destinataire), 'smtp'); } if (!$result and $globalConfig->getConf()->getExecEnvironment() == EnvironmentConf::ENV_PRD) { $paramTypeMail = "Erreur"; } } /** * Génération de log */ $paramLog = $paramTypeMail . " " . $expediteur . " " . $destinataire . "\n" . $sujetmail . "\n" . $text; // Logger::AddMail($paramLog, $paramTypeMail); }
public function sendMail($strSubject, $strHtmlBody, $strSender, $arrRecipients) { $strReturn = ""; //*** Build the e-mail. $strTextBody = str_replace("<br /> ", "<br />", $strHtmlBody); $strTextBody = str_replace("<br />", "\n", $strTextBody); $strTextBody = str_replace(" ", "", $strTextBody); $strTextBody = strip_tags($strTextBody); $strTextBody = html_entity_decode($strTextBody, ENT_COMPAT, "UTF-8"); //*** Send the email. $objMail = new htmlMimeMail5(); $objMail->setHTMLEncoding(new Base64Encoding()); $objMail->setTextCharset("utf-8"); $objMail->setHTMLCharset("utf-8"); $objMail->setHeadCharset("utf-8"); $objMail->setFrom($strSender); $objMail->setSubject($strSubject); $objMail->setText($strTextBody); $objMail->setHTML($strHtmlBody); if (!$objMail->send($arrRecipients)) { $strReturn = $objMail->errors; } return $strReturn; }
public function sendMsgNow($message) { $mType = $message->mType; $recp = westorElggMan_get_entity($message->toId); $sender = westorElggMan_get_entity($message->fromId); $senderEmail = $this->getEntityProperty($sender, elgg_echo('ElggMan_:cEmail')); $subject = $message->title; $body = $message->description; if ($message->mType == "EMAIL" || $message->mType == "EMAILTXT") { $mail = new htmlMimeMail5(); } switch ($message->mType) { case "EMAIL": $mail->setHTMLCharset("UTF-8"); $mail->setHTML($body); case "EMAILTXT": $mail->setTextCharset("UTF-8"); $mail->setHeadCharset("UTF-8"); $mail->setFrom($senderEmail); $mail->setSubject($subject); $search = array("|<br[[:space:]]*/?[[:space:]]*>|i", "|</p>|i"); $replace = array("\r\n", "\r\n"); $mail->setText(strip_tags(html_entity_decode(preg_replace($search, $replace, $body)))); if ($recp->getSubtype() == "PrivateContact") { $mail->send(array($recp->user_email)); } else { $mail->send(array($recp->email)); } $message->waitForSend = 0; // mark as done $message->state = 'OK'; break; case "HQ-SMS": $senderNumber = $sender->westorElggManSMSSender; $recipientNumber = $this->getEntityProperty($recp, elgg_echo('ElggMan_:cMobile')); $result = $this->sendSMSToGateway($senderNumber, $recipientNumber, $body, $message->mType); if ($result["success"]) { $message->waitForSend = 0; // mark as done $message->state = 'OK'; } else { if ($message->retryed >= 3) { $message->waitForSend = 0; // mark as done $message->state = 'FAILED'; } $message->retryed++; } break; default: } // switch $message->save(); return $result; }