Example #1
0
 /**
  *发送邮件
  *
  *@param   string  发送邮箱地址
  *@param   array   接收邮箱地址
  *@param   array   抄送人
  *@param   string  邮件标题
  *@param   string  邮件内容
  *@param   array   文件附件,地址格式
  *@param   string  编码格式
  */
 public function send($from, $to, $cc = '', $subject, $content = '', $files = '', $char = 'utf-8')
 {
     $site_email = new htmlMimeMail5();
     $site_email->setHeadCharset($char);
     $site_email->setTextCharset($char);
     $site_email->setHtmlCharset($char);
     $site_email->setFrom($from);
     $site_email->setSubject($subject);
     $site_email->setHTML($content);
     $site_email->setCc($cc);
     $address = explode(",", $to);
     if ($files != '') {
         foreach ($files as $file) {
             if (file_exists($file)) {
                 $attachment = new fileAttachment($file);
                 $site_email->addAttachment($attachment);
             } else {
                 $this->logger->write_log('ERROR', 'MAIL: attachment ' . $file . ' not exists');
             }
         }
     }
     foreach ($address as $k) {
         $mail[$k] = 1;
     }
     foreach ($mail as $k => $v) {
         $address_new[] = $k;
     }
     if ($site_email->send($address_new)) {
         return true;
     } else {
         return false;
     }
 }
Example #2
0
 * |                                                                              |
 * |                  http://www.phpguru.org/static/license.html                  |
 * o------------------------------------------------------------------------------o
 *
 * © Copyright 2008,2009 Richard Heyes
 */
/**
 * This example shows you how to create an email with another email attached
 */
require_once 'htmlMimeMail5.php';
/**
 * Create the attached email
 */
$attachment = new htmlMimeMail5();
$attachment->setFrom('Bob <*****@*****.**>');
$attachment->setText('This email is attached.');
$attachment->setSubject('This email is attached.');
$body = $attachment->getRFC822(array('*****@*****.**'));
/**
 * Now create the email it will be attached to
 */
$mail = new htmlMimeMail5();
$mail->addAttachment(new StringAttachment($body, 'Attached message', 'message/rfc822', new SevenBitEncoding()));
$mail->addAttachment(new FileAttachment('example.zip'));
$mail->setFrom('Richard <*****@*****.**>');
$mail->setSubject('Test email');
$mail->setText('Sample text');
$result = $mail->send(array('*****@*****.**'));
?>

Message has been sent
 function handleForm($valuesAssocArray)
 {
     $this->classes();
     switch ($valuesAssocArray["action"]) {
         case "register":
             $F = new Factory("Adresse");
             $F->sA("firma", $valuesAssocArray["firma"]);
             $F->sA("strasse", $valuesAssocArray["strasse"]);
             $F->sA("nr", $valuesAssocArray["nr"]);
             $F->sA("plz", $valuesAssocArray["plz"]);
             $F->sA("ort", $valuesAssocArray["ort"]);
             $F->sA("email", $valuesAssocArray["userEmail"]);
             //from email
             $F->sA("tel", $valuesAssocArray["tel"]);
             $AdresseID = $F->store(false, false);
             $K = new Kunden();
             $Kappendix = $K->createKundeToAdresse($AdresseID, false, true);
             $Kappendix->changeA("KappendixKontonummer", $valuesAssocArray["kontonummer"]);
             $Kappendix->changeA("KappendixBLZ", $valuesAssocArray["blz"]);
             $Kappendix->changeA("KappendixSameKontoinhaber", "1");
             $KappendixID = $Kappendix->newMe(false);
             $token = sha1($AdresseID . $KappendixID . microtime());
             $F = new Factory("PDFixUser");
             $F->sA("PDFixUserAdresseID", $AdresseID);
             $F->sA("PDFixUserKappendixID", $KappendixID);
             $F->sA("PDFixUserPDFixUserDBID", "0");
             $F->sA("PDFixUserIsActive", "0");
             $F->sA("PDFixUserVorNachname", $valuesAssocArray["userVorNachname"]);
             $F->sA("PDFixUserUsername", $valuesAssocArray["userUsername"]);
             $F->sA("PDFixUserPassword", $valuesAssocArray["userPassword"]);
             $F->sA("PDFixUserEmail", $valuesAssocArray["userEmail"]);
             $F->sA("PDFixUserRate", $valuesAssocArray["zahlungsweise"]);
             $F->sA("PDFixUserRegisteredDate", time());
             $F->sA("PDFixUserToken", $token);
             $F->store(false, false);
             $mail = new htmlMimeMail5();
             $mail->setFrom("*****@*****.**");
             $mail->setSubject(utf8_decode("PDFix Registrierung ihres Mitarbeiters " . $valuesAssocArray["userVorNachname"]));
             $mail->setText(utf8_decode("Sehr geehrte Damen und Herren,\n \nSie selbst oder Ihr Mitarbeiter/Ihre Mitarbeiterin \n" . $valuesAssocArray["userVorNachname"] . " hat sich soeben bei www.pdfix.de angemeldet. \n \nDer Account wurde angelegt.\n \nIm Anhang finden Sie unsere AGB und den Softwarelizenzvertrag.\nMit der Aktivierung des Accounts werden die AGB und Nutzungsbedingungen\nannerkannt.\n\nSobald die Abbuchungserklärung bei uns eingegangen ist,\nwird der Account innerhalb 24 Std. freigeschalten und\n\"pdfix\" kann dann genutzt werden.\n \nWenn Sie die Kosten übernehmen, dann klicken Sie auf\n\n\nnachstehenden Aktivierungslink.\n\nhttp://" . $_SERVER["HTTP_HOST"] . "" . str_replace("/ubiquitous/CustomerPage/index.php", "/ubiquitous/CustomerPage/?CC=RegistrationPDFix&activate={$token}", $_SERVER["SCRIPT_NAME"]) . "\n \n\nAnsonsten klären Sie bitte die Kostenübernahme mit Ihrem Mitarbeiter ab.\n\n \nMit freundlichen Grüßen\n \nM. Tischler\nGeschäftsführer\nETS-SÜD UG (haftungsbeschränkt)\nDR. Michael Samer Ring 2a\n86609 Donauwörth\nAG Augsburg\nHRB 26204\ninfo@pdfix.de"));
             /*
             Zum Download von pdfix besuchen Sie bitte
             http://www.meine-smn.de und klicken auf \"Login\"
             
             melden Sie sich an mit:
             
             Benutzername: ".$valuesAssocArray["userUsername"]."
             Passwort: ".$valuesAssocArray["userPassword"]."
             
             Bestätigen Sie jeweils am Ende der Seiten die AGB´s und Lizenzbedingungen und
             laden \"pdfix\" down.
             
             Sobald die Abbuchungserklärung bei uns eingegangen ist,
             wird der Account innerhalb 24 Std. freigeschalten,und
             \"pdfix\" kann dann genutzt werden.
             */
             #$mail->setTextCharset("UTF-8");
             #$mail->addAttachment(new fileAttachment(Util::getRootPath()."open3A/PDFix/abbuchungserkl.pdf", "application/pdf"));
             $mail->addAttachment(new fileAttachment(Util::getRootPath() . "../download/Agbs.pdf", "application/pdf"));
             $mail->addAttachment(new fileAttachment(Util::getRootPath() . "../download/Softwarelizenzvertrag.pdf", "application/pdf"));
             if (!$mail->send(array($valuesAssocArray["userEmail"]))) {
                 //from email
                 Red::errorD("Die E-Mail konnte nicht verschickt werden, bitte versuchen Sie es erneut!");
             }
             break;
         case "activate":
             $PU = anyC::getFirst("PDFixUser", "PDFixUserToken", $valuesAssocArray["token"]);
             $PU->changeA("PDFixUserActivatedDate", time());
             $PU->changeA("PDFixUserIsActive", "1");
             $PU->changeA("PDFixUserRate", $valuesAssocArray["zahlungsweise"]);
             $PU->saveMe();
             $mail = new htmlMimeMail5();
             $mail->setFrom("*****@*****.**");
             $mail->setSubject(utf8_decode("PDFix Registrierung ihres Mitarbeiters " . $valuesAssocArray["userVorNachname"]));
             $mail->setText(utf8_decode("Sehr geehrte Damen und Herren,\n \nIhr Account wurde soeben angelegt.\n \nBenutzername: " . $PU->A("PDFixUserUsername") . "\nPasswort: " . $PU->A("PDFixUserPassword") . "\n \nSobald die Abbuchungserklärung bei uns eingegangen ist,\nwird der Account innerhalb 24 Std. freigeschalten und\n\"pdfix\" kann dann genutzt werden.\n\t\n\nMit freundlichen Grüßen\n \nM. Tischler\nGeschäftsführer\nETS-SÜD UG (haftungsbeschränkt)\nDR. Michael Samer Ring 2a\n86609 Donauwörth\nAG Augsburg\nHRB 26204\ninfo@pdfix.de"));
             /*
             Zum Download von pdfix besuchen Sie bitte
             http://www.meine-smn.de und klicken auf \"Login\"
             
             melden Sie sich an mit:
             
             Bestätigen Sie jeweils am Ende der Seiten die AGB´s und Lizenzbedingungen und
             laden \"pdfix\" down.
             */
             #$mail->setTextCharset("UTF-8");
             if (!$mail->send(array($PU->A("PDFixUserEmail")))) {
                 Red::errorD("Die E-Mail konnte nicht verschickt werden, bitte versuchen Sie es erneut!");
             }
             $Adresse = new Adresse($PU->A("PDFixUserAdresseID"));
             $mail = new htmlMimeMail5();
             $mail->setFrom("*****@*****.**");
             $mail->setSubject("PDFix Aktivierung");
             $mail->setText(utf8_decode("\nFirma: " . $Adresse->A("firma") . "\nBenutzername: " . $PU->A("PDFixUserUsername") . ""));
             #$mail->setTextCharset("UTF-8");
             if (!$mail->send(array("*****@*****.**"))) {
                 Red::errorD("Die E-Mail konnte nicht verschickt werden, bitte versuchen Sie es erneut!");
             }
             break;
     }
 }
Example #4
0
 * Set the HTML of the email. Any embedded images will be automatically found as long as you have added them
 * using addEmbeddedImage() as below.
 */
$mail->setHTML('<p><b>Dear Recipient</b>,</p>
        
        <br>
          <a href="http://www.emmgts.com/export/export_cafehits.php?w=1&DB_TBLName=cafe_hits">Download Report</a>
          
        </p>
<p><img src="background.gif" width="1024" height="6" /><img src="4.jpg" width="137" height="40" /></p> ');
/**
 * Set the delivery receipt of the email. This should be an email address that the receipt should be sent to.
 * You are NOT guaranteed to receive this receipt - it is dependent on the receiver.
 */
$mail->setReceipt('*****@*****.**');
/**
 * Add an embedded image. The path is the file path to the image.
 */
$mail->addEmbeddedImage(new fileEmbeddedImage('background.gif'));
$mail->addEmbeddedImage(new fileEmbeddedImage('4.jpg'));
/**
 * Add an attachment to the email.
 */
$mail->addAttachment(new fileAttachment(''));
/**
 * Send the email. Pass the method an array of recipients.
 */
$result = $mail->send(array('*****@*****.**', '*****@*****.**', '*****@*****.**'));
?>

Example #5
0
 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);
 }
Example #6
0
	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();
		}
	}
<?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('*****@*****.**'));
Example #8
0
 /**
  * @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));
 }