diff --git a/include/Emailer.php b/include/Emailer.php deleted file mode 100644 index 978b192189..0000000000 --- a/include/Emailer.php +++ /dev/null @@ -1,85 +0,0 @@ -\n" . - "Reply-To: $fromName <{$params['replyTo']}>\n" . - "MIME-Version: 1.0\n" . - "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\""; - - // assemble the final multipart message body with the text and html types included - $textBody = chunk_split(base64_encode($params['textVersion'])); - $htmlBody = chunk_split(base64_encode($params['htmlVersion'])); - $multipartMessageBody = - "--" . $mimeBoundary . "\n" . // plain text section - "Content-Type: text/plain; charset=UTF-8\n" . - "Content-Transfer-Encoding: base64\n\n" . - $textBody . "\n"; - - if (!$email_textonly && !is_null($params['htmlVersion'])){ - $multipartMessageBody .= - "--" . $mimeBoundary . "\n" . // text/html section - "Content-Type: text/html; charset=UTF-8\n" . - "Content-Transfer-Encoding: base64\n\n" . - $htmlBody . "\n"; - } - $multipartMessageBody .= - "--" . $mimeBoundary . "--\n"; // message ending - - // send the message - $hookdata = array( - 'to' => $params['toEmail'], - 'subject' => $messageSubject, - 'body' => $multipartMessageBody, - 'headers' => $messageHeader - ); - //echo "
"; var_dump($hookdata); killme();
-		call_hooks("emailer_send", $hookdata);
-		$res = mail(
-			$hookdata['to'],							// send to address
-			$hookdata['subject'],						// subject
-			$hookdata['body'], 	 						// message body
-			$hookdata['headers']						// message headers
-		);
-		logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
-		logger("return value " . (($res)?"true":"false"), LOGGER_DEBUG);
-		return $res;
-	}
-}
diff --git a/include/enotify.php b/include/enotify.php
index 7de2027ca8..dc030fa8b8 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -1,14 +1,16 @@
  $params['uid'],
 			'fromName' => $sender_name,
 			'fromEmail' => $sender_email,
@@ -646,11 +649,11 @@ function notification($params) {
 			'messageSubject' => $datarray['subject'],
 			'htmlVersion' => $email_html_body,
 			'textVersion' => $email_text_body,
-			'additionalMailHeader' => $datarray['headers'],
-		));
+			'additionalMailHeader' => $datarray['headers'])
+		);
 	}
 
-    return False;
+	return false;
 }
 
 /**
diff --git a/mod/item.php b/mod/item.php
index 8055d63aec..97c26b5f9b 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -24,6 +24,7 @@ use Friendica\Model\GlobalContact;
 use Friendica\Network\Probe;
 use Friendica\Object\Contact;
 use Friendica\Protocol\Diaspora;
+use Friendica\Util\Emailer;
 
 require_once 'include/crypto.php';
 require_once 'include/enotify.php';
@@ -1036,13 +1037,13 @@ function item_post(App $a) {
 				$message = '' . $link . $html . $disclaimer . '';
 				include_once 'include/html2plain.php';
 				$params = array (
-				    'fromName' => $a->user['username'],
-				    'fromEmail' => $a->user['email'],
-				    'toEmail' => $addr,
-				    'replyTo' => $a->user['email'],
-				    'messageSubject' => $subject,
-				    'htmlVersion' => $message,
-				    'textVersion' => html2plain($html.$disclaimer),
+					'fromName' => $a->user['username'],
+					'fromEmail' => $a->user['email'],
+					'toEmail' => $addr,
+					'replyTo' => $a->user['email'],
+					'messageSubject' => $subject,
+					'htmlVersion' => $message,
+					'textVersion' => html2plain($html.$disclaimer)
 				);
 				Emailer::send($params);
 			}
diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php
new file mode 100644
index 0000000000..a2be983d6c
--- /dev/null
+++ b/src/Util/Emailer.php
@@ -0,0 +1,94 @@
+\n" .
+						"Reply-To: $fromName <{$params['replyTo']}>\n" .
+						"MIME-Version: 1.0\n" .
+						"Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
+
+		// assemble the final multipart message body with the text and html types included
+		$textBody	=	chunk_split(base64_encode($params['textVersion']));
+		$htmlBody	=	chunk_split(base64_encode($params['htmlVersion']));
+		$multipartMessageBody =	"--" . $mimeBoundary . "\n" .					// plain text section
+								"Content-Type: text/plain; charset=UTF-8\n" .
+								"Content-Transfer-Encoding: base64\n\n" .
+								$textBody . "\n";
+
+		if (!$email_textonly && !is_null($params['htmlVersion'])) {
+			$multipartMessageBody .=
+				"--" . $mimeBoundary . "\n" .				// text/html section
+				"Content-Type: text/html; charset=UTF-8\n" .
+				"Content-Transfer-Encoding: base64\n\n" .
+				$htmlBody . "\n";
+		}
+		$multipartMessageBody .=
+			"--" . $mimeBoundary . "--\n";					// message ending
+
+		// send the message
+		$hookdata = array(
+			'to' => $params['toEmail'],
+			'subject' => $messageSubject,
+			'body' => $multipartMessageBody,
+			'headers' => $messageHeader
+		);
+		//echo "
"; var_dump($hookdata); killme();
+		call_hooks("emailer_send", $hookdata);
+		$res = mail(
+			$hookdata['to'],							// send to address
+			$hookdata['subject'],						// subject
+			$hookdata['body'], 	 						// message body
+			$hookdata['headers']						// message headers
+		);
+		logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
+		logger("return value " . (($res)?"true":"false"), LOGGER_DEBUG);
+		return $res;
+	}
+}