Lines Matching +full:check +full:- +full:pass -(+path:inc +path:lang) -(+path:lib +path:plugins +path:lang) -(+path:lib +path:tpl +path:dokuwiki +path:lang)

5  * attachments). All mails are assumed to be in UTF-8 encoding.
49 $this->partid = substr(md5(uniqid(random_int(0, mt_getrandmax()), true)), 0, 8) . '@' . $server;
50 $this->boundary = '__________' . md5(uniqid(random_int(0, mt_getrandmax()), true));
57 $this->allowhtml = (bool)$conf['htmlmail'];
61 $this->setHeader('Return-Path', $conf['mailreturnpath']);
63 $this->setHeader('X-Mailer', 'DokuWiki');
64 $this->setHeader('X-DokuWiki-User', $INPUT->server->str('REMOTE_USER'));
65 $this->setHeader('X-DokuWiki-Title', $conf['title']);
66 $this->setHeader('X-DokuWiki-Server', $server);
67 $this->setHeader('X-Auto-Response-Suppress', 'OOF');
68 $this->setHeader('List-Id', $conf['title'] . ' <' . $listid . '>');
69 $this->setHeader('Date', date('r'), false);
70 $this->setHeader('Message-Id', "<$messageid>");
72 $this->prepareTokenReplacements();
89 $this->attach[] = [
109 $name = count($this->attach) . ".$ext";
112 $this->attach[] = [
138 $this->attachFile($file, $mime, '', 'autoembed' . $embeds);
149 * @param bool $clean remove all non-ASCII chars and line feeds?
153 $header = str_replace(' ', '-', ucwords(strtolower(str_replace('-', ' ', $header)))); // streamline casing
155 $header = preg_replace('/[^a-zA-Z0-9_ \-\.\+\@]+/', '', $header);
156 $value = preg_replace('/[^a-zA-Z0-9_ \-\.\+\@<>]+/', '', $value);
168 if (isset($this->headers[$header])) unset($this->headers[$header]);
170 $this->headers[$header] = $value;
184 $this->sendparam = $param;
193 * If you pass the HTML part or HTML replacements yourself you have to make
212 $html = preg_replace('/^----+$/m', '<hr >', $html);
217 $html = preg_replace('/\n-- <br \/>.*$/s', '', $html); //strip signature
244 $trep = array_merge($this->replacements['text'], $textrep);
245 $hrep = array_merge($this->replacements['html'], $htmlrep);
255 $this->setHTML($html);
256 $this->setText($text);
270 $this->html = $html;
282 $this->text = $text;
293 $this->setHeader('To', $address, false);
304 $this->setHeader('Cc', $address, false);
315 $this->setHeader('Bcc', $address, false);
329 $this->setHeader('From', $address, false);
339 $this->headers['Subject'] = $subject;
347 * @param string $name the name to clean-up
364 * for headers. Addresses may not contain Non-ASCII data!
410 msg(hsc("E-Mail address <$addr> is not ASCII"), -1, __LINE__, __FILE__, MSG_ADMINS_ONLY);
415 msg(hsc("E-Mail address <$addr> is not valid"), -1, __LINE__, __FILE__, MSG_ADMINS_ONLY);
430 $text = '=?UTF-8?B?' . base64_encode($text) . '?=';
462 foreach ($this->attach as $media) {
466 $cid = 'part' . $part . '.' . $this->partid;
470 $this->html = str_replace('%%' . $media['embed'] . '%%', 'cid:' . $cid, $this->html);
473 $mime .= '--' . $this->boundary . MAILHEADER_EOL;
474 $mime .= $this->wrappedHeaderLine('Content-Type', $media['mime'] . '; id="' . $cid . '"');
475 $mime .= $this->wrappedHeaderLine('Content-Transfer-Encoding', 'base64');
476 $mime .= $this->wrappedHeaderLine('Content-ID', "<$cid>");
478 $mime .= $this->wrappedHeaderLine('Content-Disposition', 'inline; filename=' . $media['name']);
480 $mime .= $this->wrappedHeaderLine('Content-Disposition', 'attachment; filename=' . $media['name']);
501 if (!$this->allowhtml) {
502 $this->html = '';
505 // check for body
506 if (!$this->text && !$this->html) {
511 $this->headers['MIME-Version'] = '1.0';
515 if (!$this->html && !count($this->attach)) { // we can send a simple single part message
516 $this->headers['Content-Type'] = 'text/plain; charset=UTF-8';
517 $this->headers['Content-Transfer-Encoding'] = 'base64';
518 $body .= chunk_split(base64_encode($this->text), 72, MAILHEADER_EOL);
520 $body .= "This is a multi-part message in MIME format." . MAILHEADER_EOL;
523 $attachments = $this->prepareAttachments();
526 if ($this->text && $this->html) {
527 $this->headers['Content-Type'] = 'multipart/alternative;' . MAILHEADER_EOL .
528 ' boundary="' . $this->boundary . 'XX"';
529 $body .= '--' . $this->boundary . 'XX' . MAILHEADER_EOL;
530 $body .= 'Content-Type: text/plain; charset=UTF-8' . MAILHEADER_EOL;
531 $body .= 'Content-Transfer-Encoding: base64' . MAILHEADER_EOL;
533 $body .= chunk_split(base64_encode($this->text), 72, MAILHEADER_EOL);
534 $body .= '--' . $this->boundary . 'XX' . MAILHEADER_EOL;
535 $body .= 'Content-Type: multipart/related;' . MAILHEADER_EOL .
536 ' boundary="' . $this->boundary . '";' . MAILHEADER_EOL .
541 $body .= '--' . $this->boundary . MAILHEADER_EOL;
542 $body .= 'Content-Type: text/html; charset=UTF-8' . MAILHEADER_EOL;
543 $body .= 'Content-Transfer-Encoding: base64' . MAILHEADER_EOL;
545 $body .= chunk_split(base64_encode($this->html), 72, MAILHEADER_EOL);
548 $body .= '--' . $this->boundary . '--' . MAILHEADER_EOL;
551 if ($this->text && $this->html) {
552 $body .= '--' . $this->boundary . 'XX--' . MAILHEADER_EOL;
567 if (empty($this->headers['From'])) $this->from($conf['mailfrom']);
568 $addrs = ['To', 'From', 'Cc', 'Bcc', 'Reply-To', 'Sender'];
570 if (isset($this->headers[$addr])) {
571 $this->headers[$addr] = $this->cleanAddress($this->headers[$addr]);
575 if (isset($this->headers['Subject'])) {
586 if (!str_starts_with($this->headers['Subject'], $prefix)) {
587 $this->headers['Subject'] = $prefix . ' ' . $this->headers['Subject'];
592 $this->headers['Subject'] = Clean::deaccent($this->headers['Subject']);
593 $this->headers['Subject'] = Clean::strip($this->headers['Subject']);
595 if (!Clean::isASCII($this->headers['Subject'])) {
596 $this->headers['Subject'] = '=?UTF-8?B?' . base64_encode($this->headers['Subject']) . '?=';
621 foreach ($this->headers as $key => $val) {
623 $headers .= $this->wrappedHeaderLine($key, $val);
638 $this->cleanHeaders();
639 $body = $this->prepareBody();
641 $headers = $this->prepareHeaders();
665 $this->replacements['text'] = [
667 'BROWSER' => $INPUT->server->str('HTTP_USER_AGENT'),
672 'USER' => $INPUT->server->str('REMOTE_USER'),
679 $this->replacements['text']['DOKUWIKIURL'],
682 $this->replacements['text']['EMAILSIGNATURE'] = "\n-- \n" . $signature . "\n";
684 $this->replacements['html'] = [
686 'BROWSER' => hsc($INPUT->server->str('HTTP_USER_AGENT')),
691 'USER' => hsc($INPUT->server->str('REMOTE_USER')),
701 [$this->replacements['html']['DOKUWIKIURL'], '<br />'],
704 $this->replacements['html']['EMAILSIGNATURE'] = $signature;
722 // pass the whole mail class to plugin
724 // pass references for backward compatibility
725 'to' => &$this->headers['To'],
726 'cc' => &$this->headers['Cc'],
727 'bcc' => &$this->headers['Bcc'],
728 'from' => &$this->headers['From'],
729 'subject' => &$this->headers['Subject'],
730 'body' => &$this->text,
731 'params' => &$this->sendparam,
739 if ($evt->advise_before(true)) {
741 $this->cleanHeaders();
745 trim($this->headers['To']) === '' &&
746 trim($this->headers['Cc']) === '' &&
747 trim($this->headers['Bcc']) === ''
751 if (array_key_exists('To', $this->headers)) {
752 $to = (string)$this->headers['To'];
753 unset($this->headers['To']);
759 if (array_key_exists('Subject', $this->headers)) {
760 $subject = (string)$this->headers['Subject'];
761 unset($this->headers['Subject']);
767 $body = $this->prepareBody();
771 $headers = $this->prepareHeaders();
780 msg(hsc($emsg), -1, __LINE__, __FILE__, MSG_MANAGERS_ONLY);
781 $evt->advise_after();
786 if ($to === '') $to = '(undisclosed-recipients)'; // #1422
787 if ($this->sendparam === null) {
790 $success = @mail($to, $subject, $body, $headers, $this->sendparam);
794 $evt->advise_after();