public function sendEmail($subject, $body, $recipientID, $parameters) { $emailData = $this->getEMailData($parameters); $parameters = explode("::", $parameters); $action = $parameters[0]; $className = $parameters[1]; $classID = $parameters[2]; $time = $parameters[3]; $C = new $className($classID); $data = $C->getCalendarDetails($className, $classID); $adresse = $data->getAdresse(); $fromName = Session::currentUser()->A("name"); $from = Session::currentUser()->A("UserEmail"); $mail = new htmlMimeMail5(); $mail->setFrom(utf8_decode($fromName . " <" . $from . ">")); if (!ini_get('safe_mode')) { $mail->setReturnPath($from); } $mail->setSubject(utf8_decode($subject)); /*if($action == "reply"){ $ics = "BEGIN:VCALENDAR PRODID:-//lightCRM Kalender VERSION:2.0 METHOD:REPLY BEGIN:VEVENT CREATED:20121130T004454Z LAST-MODIFIED:20121201T143509Z DTSTAMP:20121201T143509Z UID:7715ie5i20hvm0b71p18vhgj70@google.com SUMMARY:Test STATUS:CONFIRMED ORGANIZER;CN=rainer.furtmeier@googlemail.com:mailto:rainer.furtmeier@googl email.com ATTENDEE;CN=nemi@2sins.de;PARTSTAT=ACCEPTED;CUTYPE=INDIVIDUAL;ROLE=REQ-PAR TICIPANT;X-NUM-GUESTS=0:mailto:nemi@2sins.de DTSTART:20121206T123000Z DTEND:20121206T133000Z DESCRIPTION: SEQUENCE:5 TRANSP:OPAQUE END:VEVENT END:VCALENDAR"; }*/ if ($action == "notification") { $ics = "BEGIN:VCALENDAR\nPRODID:-//lightCRM Kalender\nVERSION:2.0\nMETHOD:REQUEST\nBEGIN:VTIMEZONE\nTZID:Europe/Berlin\nX-LIC-LOCATION:Europe/Berlin\nBEGIN:DAYLIGHT\nTZOFFSETFROM:+0100\nTZOFFSETTO:+0200\nTZNAME:CEST\nDTSTART:19700329T020000\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=3\nEND:DAYLIGHT\nBEGIN:STANDARD\nTZOFFSETFROM:+0200\nTZOFFSETTO:+0100\nTZNAME:CET\nDTSTART:19701025T030000\nRRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10\nEND:STANDARD\nEND:VTIMEZONE\nBEGIN:VEVENT\nLAST-MODIFIED:20120629T094018Z\nDTSTAMP:" . date("Ymd") . "T" . date("His") . "\nUID:" . $data->UID() . "\nSUMMARY:" . $data->summary() . "\nORGANIZER;CN=\"{$fromName}\":MAILTO:{$from}\nDTSTART;TZID=Europe/Berlin:" . date("Ymd", Kalender::parseDay($data->getDay())) . "T" . $data->getTime() . "00\nDTEND;TZID=Europe/Berlin:" . date("Ymd", Kalender::parseDay($data->getEndDay())) . "T" . $data->getEndTime() . "00\nEND:VEVENT\nEND:VCALENDAR"; } $mail->addAttachment(new stringAttachment($ics, "event.ics", 'application/ics')); $adresse->replaceByAnsprechpartner($recipientID); $body = str_replace("{Anrede}", Util::formatAnrede($_SESSION["S"]->getUserLanguage(), $adresse), $body); if ($action == "notification") { $mail->setCalendar($ics, "REQUEST"); } #if($action == "reply") # $mail->setCalendar($ics, "REPLY"); $mail->setTextCharset("UTF-8"); $mail->setCalendarCharset("UTF-8"); $mail->setText($body); #print_r($mail->getRFC822(array("*****@*****.**"))); #die(); $mail->send(array($emailData["recipients"][$recipientID][1])); $C->setNotified($className, $classID); }
public function testMail($mailfrom, $mailto) { #parse_str($data, $out); #print_r($out); if ($mailfrom == "") { Red::errorD("Bitte geben Sie einen Absender ein!"); } if ($mailto == "") { Red::errorD("Bitte geben Sie einen Empfänger ein!"); } try { $mail = new htmlMimeMail5(substr($mailfrom, stripos($mailfrom, "@") + 1)); } catch (Exception $e) { die("<p style=\"padding:5px;color:red;\">Fehler beim Übergeben der E-Mail. " . $e->getMessage() . "</p>"); } $mail->setFrom("phynx Mailtest <" . $mailfrom . ">"); if (!ini_get('safe_mode')) { $mail->setReturnPath($mailfrom); } $mail->setSubject("phynx Mailtest"); $mail->setText(wordwrap("Diese Nachricht wurde vom phynx Mailtester erzeugt. Ihre E-Mail-Einstellungen sind korrekt.", 80)); $adressen = array(); $adressen[] = $mailto; if ($mail->send($adressen)) { echo "<p style=\"padding:5px;color:green;\">E-Mail erfolgreich übergeben.</p>"; } else { echo "<p style=\"padding:5px;color:red;\">Fehler beim Übergeben der E-Mail. Bitte überprüfen Sie Ihre Server-Einstellungen.<br />Fehler: " . nl2br(print_r($mail->errors, true)) . "</p>"; } /*$mimeMail2 = new PHPMailer(false, substr($mailfrom, stripos($mailfrom, "@") + 1)); $mimeMail2->CharSet = "UTF-8"; $mimeMail2->Subject = "phynx Mailtest V2"; $mimeMail2->From = $mailfrom; $mimeMail2->Sender = $mailfrom; $mimeMail2->FromName = "phynx Mailtest"; $mimeMail2->Body = wordwrap("Diese Nachricht wurde vom phynx Mailtester erzeugt. Ihre E-Mail-Einstellungen sind korrekt.", 80); $mimeMail2->AddAddress($mailto); if($mimeMail2->Send()) echo "<p style=\"padding:5px;color:green;\">E-Mail 2 erfolgreich übergeben.</p>"; else echo "<p style=\"padding:5px;color:red;\">Fehler beim Übergeben der E-Mail 2. Bitte überprüfen Sie Ihre Server-Einstellungen.<br />Fehler: ".nl2br(print_r($mimeMail2->ErrorInfo, true))."</p>";*/ }
<?php // Instantiate the class $mail = new htmlMimeMail5(); // Set the From and Reply-To headers $mail->setFrom('Jason <*****@*****.**>'); $mail->setReturnPath('*****@*****.**'); // Set the Subject $mail->setSubject('Test with attached email'); // Set the body $mail->setText("Please find attached Chapter 16. Thank you!"); // Retrieve a file for attachment $attachment = $mail->getFile('chapter16.doc'); // Attach the file, assigning it a name and a corresponding Mime-type. $mail->addAttachment($attachment, 'chapter16.doc', 'application/vnd.ms-word'); // Send the email to editor@example.com $result = $mail->send(array('*****@*****.**'));
function enviarMail($para = "",$asunto = "",$mensaje = "",$adj = "") { if (!is_array($para)) { $para = array($para); } if (!is_array($adj)) { $adj = array($adj); } $hmm = new htmlMimeMail5(); //$hmm->setSMTPParams('smtp.msa.orange-business.com',587,'audial.fr',true,'audialsite','audial2133'); $hmm->setCrlf("\n"); $hmm->setSubject($asunto); $hmm->setText($mensaje); $hmm->setFrom("Cityzen Mobility <*****@*****.**>"); //$hmm->setFrom("UMPB "); $hmm->setReturnPath("*****@*****.**"); //$hmm->setHeader("return-path", "*****@*****.**"); //echo "ici : " . count($adj) . "<br>"; foreach ($adj as $n => $v) { if ($v != "") { //echo "ajout de " . $v . "<br>"; $hmm->addAttachment(new fileAttachment($v)); } } $result = $hmm->send($para,'mail'); //echo "----- " . date("H:i:s") . " : " . $result . "<br>"; if (!$result) { print_r($hmm->errors); die(); } }
/** * @param string $iCal * @param string $myEmail * @param int $answer possible values: accept: 1, maybe: 2, decline: 3 */ public static function answerInvitation(string $iCal, string $myEmail, int $answer) { if ($answer == "1") { $text = "akzeptiert"; } if ($answer == "2") { $text = "vorläufig akzeptiert"; } if ($answer == "3") { $text = "abgelehnt"; } $VC = new vcalendar(); $VC->parse($iCal); $event = $VC->getComponent("vevent"); $targetAttendee = "MAILTO:" . $myEmail; $i = 1; while ($valueOccur = $event->getProperty("ATTENDEE", $i, true)) { if (stripos($valueOccur["value"], $targetAttendee) === false) { $i++; continue; } $params = $valueOccur["params"]; if ($answer == "1") { $params["PARTSTAT"] = "ACCEPTED"; } if ($answer == "2") { $params["PARTSTAT"] = "TENTATIVE"; } if ($answer == "3") { $params["PARTSTAT"] = "DECLINED"; } if (isset($params["RSVP"])) { unset($params["RSVP"]); } $event->setAttendee($targetAttendee, $params, $i); $i++; } $i = 1; while ($valueOccur = $event->getProperty("ATTENDEE", $i, true)) { if (stripos($valueOccur["value"], $targetAttendee) === false) { $i++; $event->deleteProperty("ATTENDEE"); continue; } $i++; } $event->setProperty("DTSTAMP", gmdate("Ymd") . "T" . gmdate("His") . "Z"); $event->setProperty("LAST-MODIFIED", gmdate("Ymd") . "T" . gmdate("His") . "Z"); $VC->deleteComponent("vevent"); $VC->setComponent($event); $VC->setMethod("REPLY"); $ics = $VC->createCalendar(); $fromName = Session::currentUser()->A("name"); $from = Session::currentUser()->A("UserEmail"); $mail = new htmlMimeMail5(); $mail->setFrom(utf8_decode($fromName . " <" . $from . ">")); if (!ini_get('safe_mode')) { $mail->setReturnPath($from); } $mail->setSubject(utf8_decode("Antwort Termineinladung (" . ucfirst($text) . "): " . $event->getProperty("SUMMARY"))); $mail->addAttachment(new stringAttachment($ics, "invite.ics", 'application/ics')); $mail->setCalendar($ics, "REPLY"); $mail->setCalendarCharset("UTF-8"); $mail->setTextCharset("UTF-8"); $mail->setText("{$fromName} hat diesen Termin {$text}"); $organizer = str_replace("MAILTO:", "", $event->getProperty("ORGANIZER")); return $mail->send(array($organizer)); }
$user = posix_getpwuid($stat[4]); } $group = array("name" => "windows"); if (function_exists('posix_getgrgid')) { $group = posix_getgrgid($stat[5]); } $tempDirSubdirs[] = "\t" . str_pad($file . ":", 32) . str_pad("<span style=\"color:" . (($stat[4] == $infoStat[4] and $stat[5] == $infoStat[5] or !ini_get("safe_mode")) ? "green;" : "red; ") . "\">" . $user["name"] . "({$stat['4']}):" . $group["name"] . "({$stat['5']})</span>", 70) . generic(is_writable($tempDir . "/" . $file), "beschreibbar"); } closedir($fp); echo "\n"; if (isset($_GET["mailto"])) { require "../libraries/mailer/htmlMimeMail5.class.php"; $mail = new htmlMimeMail5(); $mail->setFrom("phynx Mailtest <" . $_GET["mailfrom"] . ">"); if (!ini_get('safe_mode')) { $mail->setReturnPath($_GET["mailfrom"]); } $mail->setSubject("phynx Mailtest"); $mail->setText(wordwrap("Diese Nachricht wurde vom phynx Mailtester erzeugt. Ihre E-Mail-Einstellungen sind korrekt.", 80)); $adressen = array(); $adressen[] = $_GET["mailto"]; if ($_GET["mailfrom"] != "") { if ($mail->send($adressen)) { echo "<span style=\"color:green;\">E-Mail erfolgreich übergeben.</span>\n\n"; } else { echo "<span style=\"color:red;\">Fehler beim Übergeben der E-Mail. Bitte überprüfen Sie Ihre Server-Einstellungen.\nFehler: " . print_r($mail->errors, true) . "</span>\n\n"; } } else { echo "<span style=\"color:red;\">Bitte geben Sie eine gültige Absender-Adresse ein.</span>\n\n"; } }
public function testMail($mailfrom, $mailto) { #parse_str($data, $out); #print_r($out); if ($mailfrom == "") { Red::errorD("Bitte geben Sie einen Absender ein!"); } if ($mailto == "") { Red::errorD("Bitte geben Sie einen Empfänger ein!"); } $mail = new htmlMimeMail5(); $mail->setFrom("phynx Mailtest <" . $mailfrom . ">"); if (!ini_get('safe_mode')) { $mail->setReturnPath($mailfrom); } $mail->setSubject("phynx Mailtest"); $mail->setText(wordwrap("Diese Nachricht wurde vom phynx Mailtester erzeugt. Ihre E-Mail-Einstellungen sind korrekt.", 80)); $adressen = array(); $adressen[] = $mailto; if ($mail->send($adressen)) { echo "<p style=\"padding:5px;color:green;\">E-Mail erfolgreich übergeben.</p>"; } else { echo "<p style=\"padding:5px;color:red;\">Fehler beim Übergeben der E-Mail. Bitte überprüfen Sie Ihre Server-Einstellungen.<br />Fehler: " . nl2br(print_r($mail->errors, true)) . "</p>"; } }
/** * 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); }