89 $factory = $DIC[
"mail.mime.transport.factory"];
90 self::setDefaultTransport(
$factory->getTransport());
101 throw new \InvalidArgumentException(\sprintf(
102 "The passed argument must be null or of type 'ilMailMimeTransport', %s given!",
107 self::$defaultTransport = $transport;
115 return self::$defaultTransport;
126 require_once
'Services/Mail/classes/class.ilMail.php';
156 public function To($to)
161 $this->sendto[] = $to;
169 public function Cc($cc)
184 if (is_array($bcc)) {
187 $this->abcc[] = $bcc;
254 public function Attach(
$filename, $file_type =
'', $disposition =
'inline', $display_name = null)
256 if ($file_type ==
'') {
257 $file_type =
'application/octet-stream';
261 $this->actype[] = $file_type;
262 $this->adispo[] = $disposition;
263 $this->adisplay[] = $display_name;
271 $attachments =
array();
274 foreach ($this->aattach as $attachment) {
276 if (isset($this->adisplay[
$i]) && strlen($this->adisplay[$i]) > 0) {
280 $attachments[] =
array(
281 'path' => $attachment,
295 return array_values($this->
images);
305 $this->finalBodyAlt =
'';
306 $this->finalBody =
'';
309 if ($DIC->settings()->get(
'mail_send_html', 0)) {
310 $skin = $DIC[
'ilClientIniFile']->readVariable(
'layout',
'skin');
324 if (0 == strlen($this->body)) {
328 if (strip_tags($this->body,
'<b><u><i><a>') == $this->body) {
334 $this->finalBodyAlt = strip_tags(str_ireplace(
array(
"<br />",
"<br>",
"<br/>"),
"\n", $this->body));
337 $this->finalBody = str_replace(
'{PLACEHOLDER}', $this->body, $this->
getHtmlEnvelope($skin));
346 $bracket_path =
'./Services/Mail/templates/default/tpl.html_mail_template.html';
348 if ($skin !=
'default') {
349 $tplpath =
'./Customizing/global/skin/' . $skin .
'/Services/Mail/tpl.html_mail_template.html';
351 if (file_exists($tplpath)) {
352 $bracket_path =
'./Customizing/global/skin/' . $skin .
'/Services/Mail/tpl.html_mail_template.html';
356 return file_get_contents($bracket_path);
364 $this->gatherImagesFromDirectory(
'./Services/Mail/templates/default/img');
366 if ($skin !=
'default') {
367 $skinDirectory =
'./Customizing/global/skin/' . $skin .
'/Services/Mail/img';
368 if (is_dir($skinDirectory) && is_readable($skinDirectory)) {
369 $this->gatherImagesFromDirectory($skinDirectory,
true);
378 protected function gatherImagesFromDirectory($directory, $clearPrevious =
false)
380 if ($clearPrevious) {
388 $cid =
'img/' . $file->getFilename();
391 'path' => $file->getPathname(),
393 'name' => $file->getFilename()
402 public function Send($transport = null)
405 $transport = self::getDefaultTransport();
410 return $transport->send($this);
static setDefaultTransport($transport)
Cc($cc)
Set the cc mail recipient.
__construct()
ilMimeMail constructor.
Bcc($bcc)
Set the bcc mail recipient.
Done rendering charts as images
static getDefaultTransport()
buildHtmlInlineImages($skin)
Interface ilMailMimeTransport.
Interface ilMailMimeTransport.
static makeClickable($a_text, $detectGotoLinks=false)
makeClickable In Texten enthaltene URLs und Mail-Adressen klickbar machen
Subject($subject, $a_add_prefix=false)
build()
Build the relevant email data.
Create styles array
The data for the language used.
To($to)
Set the mail recipient.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
From(ilMailMimeSender $sender)
static getSubjectPrefix()
Get text that will be prepended to auto generated mails.
Attach($filename, $file_type='', $disposition='inline', $display_name=null)
Attach a file to the mail.