Version Description
(2016-10-21) = * Fix bug where success/fail email notifications had missing info. * Fix bug where galley wan't being inserted on some plain text messages * Enhance auto linkification to recognize links like http://example.com/ * Separate success and failure emails. * Fix readme * New filter: postie_email_reject_recipients - allows recipients list to be altered when sending failure message * New filter: postie_email_reject_subject - allows the subject to be altered when sending failure message * New filter: postie_email_reject_body - allows message content to be altered when sending failure message * New filter: postie_email_notify_recipients - allows recipients list to be altered when sending success message * New filter: postie_email_notify_subject - allows the subject to be altered when sending success message * New filter: postie_email_notify_body - allows message content to be altered when sending success message
Release Info
Developer | WayneAllen |
Plugin | Postie |
Version | 1.8.8 |
Comparing to | |
See all releases |
Code changes from version 1.8.7 to 1.8.8
- docs/Changes.txt +21 -9
- docs/Postie.txt +1 -1
- docs/TODO.txt +2 -6
- lib_autolink.php +10 -11
- postie-functions.php +115 -97
- postie.php +3 -3
- readme.txt +22 -10
@@ -32,30 +32,42 @@ All script, style and body tags are stripped from html emails.
|
|
32 |
Attachments are now processed in the order they were attached.
|
33 |
|
34 |
== CHANGELOG ==
|
35 |
-
= 1.8.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
* Make code compatible with PHP 5.2
|
37 |
* Fix bug where the connection tried to use TLS even though it shouldn't
|
38 |
* Switch to stream API vs sockets since sockets don't seem to be installed typically and the stream API is core.
|
39 |
* Allow self signed certificates with socket connections
|
40 |
* Don't check peer name with socket connections, many hosting companies aren't configured correctly
|
41 |
|
42 |
-
|
43 |
-
= 1.8.6 (2016-10-19)
|
44 |
* Fix bug where the featured image was not included even though config said it should be.
|
45 |
* Ensure Socket connections try to connect with TLS 1.0, 1.1 and 1.2 if SSL is specified.
|
46 |
* Additional logging to help diagnose cURL issue.
|
47 |
|
48 |
-
= 1.8.5 (2016-10-18)
|
49 |
* Fix to check if cURL is installed before using
|
50 |
|
51 |
-
= 1.8.4 (2016-10-17)
|
52 |
* General release
|
53 |
|
54 |
-
= 1.8.3 (beta 4)
|
55 |
* Refactor attachment handling
|
56 |
* Gallery shortcode handling is now correct when there are both images and non-images.
|
57 |
|
58 |
-
= 1.8.2 (beta 3)
|
59 |
* New icon set thanks to Chris Lacey
|
60 |
* php-imap replaced by cURL and Socket connection - work sponsored by xsell.net
|
61 |
* TLS automatically detected, setting removed
|
@@ -71,9 +83,9 @@ Attachments are now processed in the order they were attached.
|
|
71 |
* New option: Text fallback. Falls back to plain if html is blank and vice versa.
|
72 |
* Support removing featured image from html
|
73 |
|
74 |
-
= 1.8.1 (beta 2)
|
75 |
|
76 |
-
= 1.8.0 (beta 1)
|
77 |
|
78 |
= 1.7.32 (2016-04-15) =
|
79 |
* Deal with incorrectly formatted date headers
|
32 |
Attachments are now processed in the order they were attached.
|
33 |
|
34 |
== CHANGELOG ==
|
35 |
+
= 1.8.8 (2016-10-21) =
|
36 |
+
* Fix bug where success/fail email notifications had missing info.
|
37 |
+
* Fix bug where galley wan't being inserted on some plain text messages
|
38 |
+
* Enhance auto linkification to recognize links like <http://example.com/>
|
39 |
+
* Separate success and failure emails.
|
40 |
+
* Fix readme
|
41 |
+
* New filter: postie_email_reject_recipients - allows recipients list to be altered when sending failure message
|
42 |
+
* New filter: postie_email_reject_subject - allows the subject to be altered when sending failure message
|
43 |
+
* New filter: postie_email_reject_body - allows message content to be altered when sending failure message
|
44 |
+
* New filter: postie_email_notify_recipients - allows recipients list to be altered when sending success message
|
45 |
+
* New filter: postie_email_notify_subject - allows the subject to be altered when sending success message
|
46 |
+
* New filter: postie_email_notify_body - allows message content to be altered when sending success message
|
47 |
+
|
48 |
+
= 1.8.7 (2016-10-20) =
|
49 |
* Make code compatible with PHP 5.2
|
50 |
* Fix bug where the connection tried to use TLS even though it shouldn't
|
51 |
* Switch to stream API vs sockets since sockets don't seem to be installed typically and the stream API is core.
|
52 |
* Allow self signed certificates with socket connections
|
53 |
* Don't check peer name with socket connections, many hosting companies aren't configured correctly
|
54 |
|
55 |
+
= 1.8.6 (2016-10-19) =
|
|
|
56 |
* Fix bug where the featured image was not included even though config said it should be.
|
57 |
* Ensure Socket connections try to connect with TLS 1.0, 1.1 and 1.2 if SSL is specified.
|
58 |
* Additional logging to help diagnose cURL issue.
|
59 |
|
60 |
+
= 1.8.5 (2016-10-18) =
|
61 |
* Fix to check if cURL is installed before using
|
62 |
|
63 |
+
= 1.8.4 (2016-10-17) =
|
64 |
* General release
|
65 |
|
66 |
+
= 1.8.3 (beta 4) =
|
67 |
* Refactor attachment handling
|
68 |
* Gallery shortcode handling is now correct when there are both images and non-images.
|
69 |
|
70 |
+
= 1.8.2 (beta 3) =
|
71 |
* New icon set thanks to Chris Lacey
|
72 |
* php-imap replaced by cURL and Socket connection - work sponsored by xsell.net
|
73 |
* TLS automatically detected, setting removed
|
83 |
* New option: Text fallback. Falls back to plain if html is blank and vice versa.
|
84 |
* Support removing featured image from html
|
85 |
|
86 |
+
= 1.8.1 (beta 2) =
|
87 |
|
88 |
+
= 1.8.0 (beta 1) =
|
89 |
|
90 |
= 1.7.32 (2016-04-15) =
|
91 |
* Deal with incorrectly formatted date headers
|
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
|
|
6 |
Tags: e-mail, email, post-by-email
|
7 |
Requires at least: 3.3.0
|
8 |
Tested up to: 4.6.1
|
9 |
-
Stable tag: 1.8.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
6 |
Tags: e-mail, email, post-by-email
|
7 |
Requires at least: 3.3.0
|
8 |
Tested up to: 4.6.1
|
9 |
+
Stable tag: 1.8.8
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -1,20 +1,16 @@
|
|
1 |
-
IMAP-replacement
|
2 |
-
Announcement on postieplugin.com & forum
|
3 |
-
check other addons for compatibility
|
4 |
-
notify affected addon owners of updated addons
|
5 |
-
|
6 |
AddOn Ideas
|
7 |
Header/footer stripper - user provides "selector" (xpath) to identify header/footer and element is removed safely for html
|
8 |
selector = "div.footer" (div with the class "footer")
|
9 |
May need to remove parent (or granparent of element)
|
10 |
How to help non-techies build the selector?
|
11 |
CSS Inliner - use one of the online services to convert class styled html to inline styles. https://www.google.com/search?q=css+inline+tool&oq=css+inline+tool
|
|
|
12 |
|
13 |
Automatic updates for AddOns:
|
14 |
https://github.com/seedprod/sellwp-updater
|
15 |
http://code.tutsplus.com/series/create-a-license-controlled-theme-and-plugin-update-system--cms-760
|
16 |
|
17 |
-
|
18 |
#img# caption feature not working
|
19 |
|
20 |
Other
|
|
|
|
|
|
|
|
|
|
|
1 |
AddOn Ideas
|
2 |
Header/footer stripper - user provides "selector" (xpath) to identify header/footer and element is removed safely for html
|
3 |
selector = "div.footer" (div with the class "footer")
|
4 |
May need to remove parent (or granparent of element)
|
5 |
How to help non-techies build the selector?
|
6 |
CSS Inliner - use one of the online services to convert class styled html to inline styles. https://www.google.com/search?q=css+inline+tool&oq=css+inline+tool
|
7 |
+
Email notifications - use postie_email_* filters and some new settings panels along with some templating
|
8 |
|
9 |
Automatic updates for AddOns:
|
10 |
https://github.com/seedprod/sellwp-updater
|
11 |
http://code.tutsplus.com/series/create-a-license-controlled-theme-and-plugin-update-system--cms-760
|
12 |
|
13 |
+
Bugs
|
14 |
#img# caption feature not working
|
15 |
|
16 |
Other
|
@@ -17,15 +17,15 @@ class PostieAutolink {
|
|
17 |
|
18 |
function autolink($text, $oembed = null, $limit = 200, $tagfill = '', $auto_title = true) {
|
19 |
|
20 |
-
$text = $this->autolink_do($text, '![a-z][a-z-]
|
21 |
$text = $this->autolink_do($text, '!(mailto|skype):!i', $limit, $tagfill, $auto_title);
|
22 |
-
$text = $this->autolink_do($text, '!www
|
23 |
return $text;
|
24 |
}
|
25 |
|
26 |
function autolink_do($text, $sub, $limit, $tagfill, $auto_title, $force_prefix = null, $oembed = null) {
|
27 |
|
28 |
-
$text_l =
|
29 |
$cursor = 0;
|
30 |
$loop = 1;
|
31 |
$buffer = '';
|
@@ -61,7 +61,7 @@ class PostieAutolink {
|
|
61 |
$last_bit = array_pop($bits);
|
62 |
if (preg_match("!<a\s!i", $last_bit)) {
|
63 |
|
64 |
-
|
65 |
|
66 |
$ok = 0;
|
67 |
$cursor += $fail_len;
|
@@ -94,9 +94,9 @@ class PostieAutolink {
|
|
94 |
if ($ok) {
|
95 |
|
96 |
if ($pre) {
|
97 |
-
if (!preg_match('![\s\(\[\{
|
98 |
|
99 |
-
|
100 |
|
101 |
$ok = 0;
|
102 |
$cursor += $fail_len;
|
@@ -120,7 +120,6 @@ class PostieAutolink {
|
|
120 |
|
121 |
$url = html_entity_decode($url);
|
122 |
|
123 |
-
|
124 |
#
|
125 |
# remove trailing punctuation from url
|
126 |
#
|
@@ -197,7 +196,7 @@ class PostieAutolink {
|
|
197 |
$buffer .= "<a href=\"{$link_url_enc}\"$currentTagfill>{$display_url_enc}</a>";
|
198 |
}
|
199 |
} else {
|
200 |
-
|
201 |
|
202 |
$ok = 0;
|
203 |
$cursor += $fail_len;
|
@@ -237,7 +236,7 @@ class PostieAutolink {
|
|
237 |
$atom = '[^()<>@,;:\\\\".\\[\\]\\x00-\\x20\\x7f]+'; # from RFC822
|
238 |
#die($atom);
|
239 |
|
240 |
-
$text_l =
|
241 |
$cursor = 0;
|
242 |
$loop = 1;
|
243 |
$buffer = '';
|
@@ -320,7 +319,7 @@ class PostieAutolink {
|
|
320 |
$pre = substr($pre, 0, $plen - $len);
|
321 |
} else {
|
322 |
|
323 |
-
|
324 |
|
325 |
$ok = 0;
|
326 |
$cursor += $fail_len;
|
@@ -342,7 +341,7 @@ class PostieAutolink {
|
|
342 |
$hit .= substr($post, 0, $len);
|
343 |
$post = substr($post, $len);
|
344 |
} else {
|
345 |
-
|
346 |
|
347 |
$ok = 0;
|
348 |
$cursor += $fail_len;
|
17 |
|
18 |
function autolink($text, $oembed = null, $limit = 200, $tagfill = '', $auto_title = true) {
|
19 |
|
20 |
+
$text = $this->autolink_do($text, '![a-z][a-z-]+:\/\/!i', $limit, $tagfill, $auto_title, null, $oembed);
|
21 |
$text = $this->autolink_do($text, '!(mailto|skype):!i', $limit, $tagfill, $auto_title);
|
22 |
+
$text = $this->autolink_do($text, '!www\.!i', $limit, $tagfill, $auto_title, 'http://', $oembed);
|
23 |
return $text;
|
24 |
}
|
25 |
|
26 |
function autolink_do($text, $sub, $limit, $tagfill, $auto_title, $force_prefix = null, $oembed = null) {
|
27 |
|
28 |
+
$text_l = strtolower($text);
|
29 |
$cursor = 0;
|
30 |
$loop = 1;
|
31 |
$buffer = '';
|
61 |
$last_bit = array_pop($bits);
|
62 |
if (preg_match("!<a\s!i", $last_bit)) {
|
63 |
|
64 |
+
DebugEcho("autolink_do: fail 1 at $cursor");
|
65 |
|
66 |
$ok = 0;
|
67 |
$cursor += $fail_len;
|
94 |
if ($ok) {
|
95 |
|
96 |
if ($pre) {
|
97 |
+
if (!preg_match('![\s\(\[\{><]$!s', $pre)) {
|
98 |
|
99 |
+
DebugEcho("autolink_do: fail 2 at $cursor ($pre)");
|
100 |
|
101 |
$ok = 0;
|
102 |
$cursor += $fail_len;
|
120 |
|
121 |
$url = html_entity_decode($url);
|
122 |
|
|
|
123 |
#
|
124 |
# remove trailing punctuation from url
|
125 |
#
|
196 |
$buffer .= "<a href=\"{$link_url_enc}\"$currentTagfill>{$display_url_enc}</a>";
|
197 |
}
|
198 |
} else {
|
199 |
+
DebugEcho("autolink_do: fail 3 at $cursor");
|
200 |
|
201 |
$ok = 0;
|
202 |
$cursor += $fail_len;
|
236 |
$atom = '[^()<>@,;:\\\\".\\[\\]\\x00-\\x20\\x7f]+'; # from RFC822
|
237 |
#die($atom);
|
238 |
|
239 |
+
$text_l = strtolower($text);
|
240 |
$cursor = 0;
|
241 |
$loop = 1;
|
242 |
$buffer = '';
|
319 |
$pre = substr($pre, 0, $plen - $len);
|
320 |
} else {
|
321 |
|
322 |
+
DebugEcho("autolink_email: fail 2 at $cursor ($pre)");
|
323 |
|
324 |
$ok = 0;
|
325 |
$cursor += $fail_len;
|
341 |
$hit .= substr($post, 0, $len);
|
342 |
$post = substr($post, $len);
|
343 |
} else {
|
344 |
+
DebugEcho("autolink_email: fail 3 at $cursor ($post)");
|
345 |
|
346 |
$ok = 0;
|
347 |
$cursor += $fail_len;
|
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
$Id: postie-functions.php
|
4 |
*/
|
5 |
|
6 |
class PostiePostModifiers {
|
@@ -209,11 +209,15 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
|
|
209 |
DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
|
210 |
$html = '';
|
211 |
if (!$config['include_featured_image']) {
|
|
|
212 |
$fiid = get_post_thumbnail_id($post_id);
|
213 |
}
|
|
|
214 |
|
215 |
foreach ($mimeDecodedEmail['attachment'] as $attachment) {
|
216 |
-
|
|
|
|
|
217 |
if (!$addimages && $attachment['primary'] == 'image') {
|
218 |
DebugEcho("filter_AttachmentTemplates: skip image " . $attachment['filename']);
|
219 |
} else {
|
@@ -226,7 +230,9 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
|
|
226 |
|
227 |
if ($config['prefer_text_type'] == 'plain') {
|
228 |
foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
|
229 |
-
|
|
|
|
|
230 |
if (!$addimages && $attachment['primary'] == 'image') {
|
231 |
DebugEcho("filter_AttachmentTemplates: skip image (alt) " . $attachment['filename']);
|
232 |
} else {
|
@@ -266,6 +272,14 @@ function filter_AttachmentTemplates($content, $mimeDecodedEmail, $post_id, $conf
|
|
266 |
$imagecount++;
|
267 |
}
|
268 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
269 |
DebugEcho("filter_AttachmentTemplates: image count $imagecount");
|
270 |
|
271 |
if (($imagecount > 0) && $config['auto_gallery']) {
|
@@ -459,7 +473,7 @@ function postie_create_post($poster, $mimeDecodedEmail, $post_id, &$is_reply, $c
|
|
459 |
|
460 |
//handle inline images after linkify
|
461 |
if ('plain' == $config['prefer_text_type']) {
|
462 |
-
$content = filter_ReplaceInlineImage($content, $mimeDecodedEmail);
|
463 |
if ($fulldebug) {
|
464 |
DebugEcho("post filter_ReplaceInlineImage: $content");
|
465 |
}
|
@@ -544,9 +558,7 @@ function PostEmail($poster, $mimeDecodedEmail, $config) {
|
|
544 |
} elseif ($config['confirmation_email'] == 'both') {
|
545 |
$recipients = array($details['email_author'], get_option("admin_email"));
|
546 |
}
|
547 |
-
|
548 |
-
MailToRecipients($mimeDecodedEmail, $recipients, false, false, $postid);
|
549 |
-
}
|
550 |
}
|
551 |
}
|
552 |
} else {
|
@@ -1113,20 +1125,17 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
|
|
1113 |
$poster = NULL;
|
1114 |
$from = "";
|
1115 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('from', $mimeDecodedEmail['headers'])) {
|
1116 |
-
//$from = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["from"]));
|
1117 |
$from = $mimeDecodedEmail['headers']['from']['mailbox'] . '@' . $mimeDecodedEmail['headers']['from']['host'];
|
1118 |
$from = apply_filters('postie_filter_email', $from);
|
1119 |
DebugEcho("ValidatePoster: post postie_filter_email $from");
|
1120 |
|
1121 |
$toEmail = '';
|
1122 |
if (isset($mimeDecodedEmail['headers']['to'])) {
|
1123 |
-
//$toEmail = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["to"]));
|
1124 |
$toEmail = $mimeDecodedEmail['headers']['to'][0]['mailbox'] . '@' . $mimeDecodedEmail['headers']['to'][0]['host'];
|
1125 |
}
|
1126 |
|
1127 |
$replytoEmail = '';
|
1128 |
if (isset($mimeDecodedEmail['headers']['reply-to'])) {
|
1129 |
-
//$replytoEmail = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail->headers["reply-to"]));
|
1130 |
$replytoEmail = $mimeDecodedEmail['headers']['reply-to']['mailbox'] . '@' . $mimeDecodedEmail['headers']['reply-to']['host'];
|
1131 |
}
|
1132 |
|
@@ -1144,7 +1153,7 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
|
|
1144 |
|
1145 |
$resentFrom = "";
|
1146 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('resent-from', $mimeDecodedEmail['headers'])) {
|
1147 |
-
$resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail
|
1148 |
}
|
1149 |
|
1150 |
//See if the email address is one of the special authorized ones
|
@@ -1189,12 +1198,8 @@ function ValidatePoster(&$mimeDecodedEmail, $config) {
|
|
1189 |
if (!$poster) {
|
1190 |
EchoError('Invalid sender: ' . htmlentities($from) . "! Not adding email!");
|
1191 |
if ($config['forward_rejected_mail']) {
|
1192 |
-
$
|
1193 |
-
|
1194 |
-
EchoError("A copy of the message has been forwarded to the administrator.");
|
1195 |
-
} else {
|
1196 |
-
EchoError("The message was unable to be forwarded to the adminstrator.");
|
1197 |
-
}
|
1198 |
}
|
1199 |
return '';
|
1200 |
}
|
@@ -1718,99 +1723,106 @@ function filename_fix($filename) {
|
|
1718 |
return str_replace('%', '', urlencode($filename));
|
1719 |
}
|
1720 |
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
|
|
|
|
|
|
|
|
|
|
1727 |
|
1728 |
$myemailadd = get_option("admin_email");
|
1729 |
$blogname = get_option("blogname");
|
1730 |
$eblogname = "=?utf-8?b?" . base64_encode($blogname) . "?= ";
|
1731 |
-
$posturl =
|
1732 |
-
|
1733 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1734 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1735 |
|
1736 |
if (count($recipients) == 0) {
|
1737 |
-
DebugEcho("
|
1738 |
-
return
|
1739 |
}
|
1740 |
|
1741 |
-
$
|
|
|
1742 |
|
1743 |
-
$
|
1744 |
-
$subject = $mail_content->headers['subject'];
|
1745 |
if ($returnToSender) {
|
1746 |
-
DebugEcho("
|
1747 |
array_push($recipients, $from);
|
1748 |
}
|
1749 |
|
1750 |
-
$
|
1751 |
-
|
1752 |
-
$recipient = trim($recipient);
|
1753 |
-
if (!empty($recipient)) {
|
1754 |
-
$headers .= "Cc: " . $recipient . "\r\n";
|
1755 |
-
}
|
1756 |
-
}
|
1757 |
|
1758 |
-
|
1759 |
-
|
1760 |
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
$message .= "\n\nThe original content of the email has been attached.\n\n";
|
1779 |
-
$mailtext = "--$boundary\r\n";
|
1780 |
-
$mailtext .= "Content-Type: text/plain;format=flowed;charset=\"iso-8859-1\";reply-type=original\n";
|
1781 |
-
$mailtext .= "Content-Transfer-Encoding: 7bit\n";
|
1782 |
-
$mailtext .= "\n";
|
1783 |
-
$mailtext .= "$message\n";
|
1784 |
-
if ($mail_content->parts) {
|
1785 |
-
$mailparts = $mail_content->parts;
|
1786 |
-
} else {
|
1787 |
-
$mailparts[] = $mail_content;
|
1788 |
-
}
|
1789 |
-
foreach ($mailparts as $part) {
|
1790 |
-
$mailtext .= "--$boundary\r\n";
|
1791 |
-
if (array_key_exists('content-type', $part->headers)) {
|
1792 |
-
$mailtext .= "Content-Type: " . $part->headers['content-type'] . "\n";
|
1793 |
-
}
|
1794 |
-
if (array_key_exists('content-transfer-encoding', $part->headers)) {
|
1795 |
-
$mailtext .= "Content-Transfer-Encoding: " . $part->headers['content-transfer-encoding'] . "\n";
|
1796 |
-
}
|
1797 |
-
if (array_key_exists('content-disposition', $part->headers)) {
|
1798 |
-
$mailtext .= "Content-Disposition: " . $part->headers['content-disposition'] . "\n";
|
1799 |
-
}
|
1800 |
-
$mailtext .= "\n";
|
1801 |
-
if (property_exists($part, 'body')) {
|
1802 |
-
$mailtext .= $part->body;
|
1803 |
-
}
|
1804 |
-
}
|
1805 |
-
} else {
|
1806 |
-
$alert_subject = "Successfully posted to $blogname";
|
1807 |
-
$mailtext = "Your post '$subject' has been successfully published to $blogname <$posturl>.\n";
|
1808 |
-
DebugEcho("MailToRecipients: $alert_subject\n$mailtext");
|
1809 |
}
|
1810 |
|
1811 |
-
|
|
|
1812 |
|
1813 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1814 |
}
|
1815 |
|
1816 |
/**
|
@@ -2026,15 +2038,21 @@ function filter_ReplaceImageCIDs($content, &$email) {
|
|
2026 |
return $content;
|
2027 |
}
|
2028 |
|
2029 |
-
function filter_ReplaceInlineImage($content, &$email) {
|
2030 |
DebugEcho('filter_ReplaceInlineImage: start');
|
2031 |
foreach ($email['inline'] as &$inlineImage) {
|
2032 |
-
$
|
2033 |
-
|
2034 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2035 |
DebugEcho('filter_ReplaceInlineImage: ' . $inlineImage['filename']);
|
2036 |
-
$content = str_ireplace($
|
2037 |
-
$inlineImage['exclude'] =
|
2038 |
} else {
|
2039 |
DebugEcho('filter_ReplaceInlineImage: not found: ' . $inlineImage['filename']);
|
2040 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
+
$Id: postie-functions.php 1519547 2016-10-21 21:16:58Z WayneAllen $
|
4 |
*/
|
5 |
|
6 |
class PostiePostModifiers {
|
209 |
DebugEcho("filter_AttachmentTemplates: looking for attachments to add to post");
|
210 |
$html = '';
|
211 |
if (!$config['include_featured_image']) {
|
212 |
+
//find the image to exclude
|
213 |
$fiid = get_post_thumbnail_id($post_id);
|
214 |
}
|
215 |
+
DebugEcho("filter_AttachmentTemplates: featured image: $fiid");
|
216 |
|
217 |
foreach ($mimeDecodedEmail['attachment'] as $attachment) {
|
218 |
+
DebugEcho("filter_AttachmentTemplates: image: " . $attachment['filename']);
|
219 |
+
$skip = ($fiid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
|
220 |
+
if (!$skip) {
|
221 |
if (!$addimages && $attachment['primary'] == 'image') {
|
222 |
DebugEcho("filter_AttachmentTemplates: skip image " . $attachment['filename']);
|
223 |
} else {
|
230 |
|
231 |
if ($config['prefer_text_type'] == 'plain') {
|
232 |
foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
|
233 |
+
DebugEcho("filter_AttachmentTemplates: image: " . $attachment['filename']);
|
234 |
+
$skip = ($fiid == $attachment['wp_id'] && !$config['include_featured_image']) || $attachment['exclude'];
|
235 |
+
if (!$skip) {
|
236 |
if (!$addimages && $attachment['primary'] == 'image') {
|
237 |
DebugEcho("filter_AttachmentTemplates: skip image (alt) " . $attachment['filename']);
|
238 |
} else {
|
272 |
$imagecount++;
|
273 |
}
|
274 |
}
|
275 |
+
if ($config['prefer_text_type'] == 'plain') {
|
276 |
+
foreach (array_merge($mimeDecodedEmail['inline'], $mimeDecodedEmail['related']) as $attachment) {
|
277 |
+
DebugEcho("filter_AttachmentTemplates: attachment mime primary: {$attachment['primary']}");
|
278 |
+
if ($attachment['primary'] == 'image' && $attachment['exclude'] == false) {
|
279 |
+
$imagecount++;
|
280 |
+
}
|
281 |
+
}
|
282 |
+
}
|
283 |
DebugEcho("filter_AttachmentTemplates: image count $imagecount");
|
284 |
|
285 |
if (($imagecount > 0) && $config['auto_gallery']) {
|
473 |
|
474 |
//handle inline images after linkify
|
475 |
if ('plain' == $config['prefer_text_type']) {
|
476 |
+
$content = filter_ReplaceInlineImage($content, $mimeDecodedEmail, $config);
|
477 |
if ($fulldebug) {
|
478 |
DebugEcho("post filter_ReplaceInlineImage: $content");
|
479 |
}
|
558 |
} elseif ($config['confirmation_email'] == 'both') {
|
559 |
$recipients = array($details['email_author'], get_option("admin_email"));
|
560 |
}
|
561 |
+
postie_email_notify($mimeDecodedEmail, $recipients, $postid);
|
|
|
|
|
562 |
}
|
563 |
}
|
564 |
} else {
|
1125 |
$poster = NULL;
|
1126 |
$from = "";
|
1127 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('from', $mimeDecodedEmail['headers'])) {
|
|
|
1128 |
$from = $mimeDecodedEmail['headers']['from']['mailbox'] . '@' . $mimeDecodedEmail['headers']['from']['host'];
|
1129 |
$from = apply_filters('postie_filter_email', $from);
|
1130 |
DebugEcho("ValidatePoster: post postie_filter_email $from");
|
1131 |
|
1132 |
$toEmail = '';
|
1133 |
if (isset($mimeDecodedEmail['headers']['to'])) {
|
|
|
1134 |
$toEmail = $mimeDecodedEmail['headers']['to'][0]['mailbox'] . '@' . $mimeDecodedEmail['headers']['to'][0]['host'];
|
1135 |
}
|
1136 |
|
1137 |
$replytoEmail = '';
|
1138 |
if (isset($mimeDecodedEmail['headers']['reply-to'])) {
|
|
|
1139 |
$replytoEmail = $mimeDecodedEmail['headers']['reply-to']['mailbox'] . '@' . $mimeDecodedEmail['headers']['reply-to']['host'];
|
1140 |
}
|
1141 |
|
1153 |
|
1154 |
$resentFrom = "";
|
1155 |
if (array_key_exists('headers', $mimeDecodedEmail) && array_key_exists('resent-from', $mimeDecodedEmail['headers'])) {
|
1156 |
+
$resentFrom = RemoveExtraCharactersInEmailAddress(trim($mimeDecodedEmail['headers']['resent-from']));
|
1157 |
}
|
1158 |
|
1159 |
//See if the email address is one of the special authorized ones
|
1198 |
if (!$poster) {
|
1199 |
EchoError('Invalid sender: ' . htmlentities($from) . "! Not adding email!");
|
1200 |
if ($config['forward_rejected_mail']) {
|
1201 |
+
postie_email_reject($mimeDecodedEmail, array(get_option("admin_email")), $config['return_to_sender']);
|
1202 |
+
EchoError("A copy of the message has been forwarded to the administrator.");
|
|
|
|
|
|
|
|
|
1203 |
}
|
1204 |
return '';
|
1205 |
}
|
1723 |
return str_replace('%', '', urlencode($filename));
|
1724 |
}
|
1725 |
|
1726 |
+
function postie_email_notify($email, $recipients, $postid) {
|
1727 |
+
DebugEcho("postie_email_notify: start");
|
1728 |
+
|
1729 |
+
if (count($recipients) == 0) {
|
1730 |
+
DebugEcho("postie_email_notify: no recipients");
|
1731 |
+
return;
|
1732 |
+
}
|
1733 |
+
if (empty($postid)) {
|
1734 |
+
DebugEcho("postie_email_notify: no post id");
|
1735 |
+
return;
|
1736 |
+
}
|
1737 |
|
1738 |
$myemailadd = get_option("admin_email");
|
1739 |
$blogname = get_option("blogname");
|
1740 |
$eblogname = "=?utf-8?b?" . base64_encode($blogname) . "?= ";
|
1741 |
+
$posturl = get_permalink($postid);
|
1742 |
+
$subject = $email['headers']['subject'];
|
1743 |
+
|
1744 |
+
$sendheaders = array("From: $eblogname <$myemailadd>");
|
1745 |
+
|
1746 |
+
$mailtext = "Your post '$subject' has been successfully published to $blogname <$posturl>.\n";
|
1747 |
+
|
1748 |
+
$recipients = apply_filters('postie_email_notify_recipients', $recipients, $email, $postid);
|
1749 |
+
if (count($recipients) == 0) {
|
1750 |
+
DebugEcho("postie_email_notify: no recipients after postie_email_notify_recipients filter");
|
1751 |
+
return;
|
1752 |
}
|
1753 |
+
$subject = "Successfully posted to $blogname";
|
1754 |
+
$subject = apply_filter('postie_email_notify_subject', $subject, $email, $postid);
|
1755 |
+
|
1756 |
+
$message = apply_filters('postie_email_notify_body', $message, $email, $postid);
|
1757 |
+
|
1758 |
+
DebugEcho("postie_email_notify: To:");
|
1759 |
+
DebugDump($recipients);
|
1760 |
+
DebugEcho("postie_email_notify: $subject\n$mailtext");
|
1761 |
+
|
1762 |
+
wp_mail($recipients, $subject, $mailtext, $sendheaders);
|
1763 |
+
}
|
1764 |
+
|
1765 |
+
function postie_header_encode($value) {
|
1766 |
+
return "=?utf-8?b?" . base64_encode($value) . "?= ";
|
1767 |
+
}
|
1768 |
+
|
1769 |
+
function postie_email_reject($email, $recipients, $returnToSender) {
|
1770 |
+
DebugEcho("postie_email_reject: start");
|
1771 |
|
1772 |
if (count($recipients) == 0) {
|
1773 |
+
DebugEcho("postie_email_reject: no recipients");
|
1774 |
+
return;
|
1775 |
}
|
1776 |
|
1777 |
+
$blogname = get_option("blogname");
|
1778 |
+
$from = $email['headers']['from']['mailbox'] . '@' . $email['headers']['from']['host'];
|
1779 |
|
1780 |
+
$subject = $email['headers']['subject'];
|
|
|
1781 |
if ($returnToSender) {
|
1782 |
+
DebugEcho("postie_email_reject: return to sender $from");
|
1783 |
array_push($recipients, $from);
|
1784 |
}
|
1785 |
|
1786 |
+
$eblogname = postie_header_encode($blogname);
|
1787 |
+
$adminemail = get_option("admin_email");
|
|
|
|
|
|
|
|
|
|
|
1788 |
|
1789 |
+
$headers = array();
|
1790 |
+
$headers[] = "From: $eblogname <$adminemail>";
|
1791 |
|
1792 |
+
DebugEcho("postie_email_reject: To:");
|
1793 |
+
DebugDump($recipients);
|
1794 |
+
DebugEcho("postie_email_reject: header:");
|
1795 |
+
DebugDump($headers);
|
1796 |
+
|
1797 |
+
$message = "An unauthorized message has been sent to $blogname.\n";
|
1798 |
+
$message .= "Sender: $from\n";
|
1799 |
+
$message .= "Subject: $subject\n";
|
1800 |
+
$message .= "\n\nIf you wish to allow posts from this address, please add " . $from . " to the registered users list and manually add the content of the email found below.";
|
1801 |
+
$message .= "\n\nOtherwise, the email has already been deleted from the server and you can ignore this message.";
|
1802 |
+
$message .= "\n\nIf you would like to prevent postie from forwarding mail in the future, please change the FORWARD_REJECTED_MAIL setting in the Postie settings panel";
|
1803 |
+
$message .= "\n\nThe original content of the email has been attached.\n\n";
|
1804 |
+
|
1805 |
+
$recipients = apply_filter('postie_email_reject_recipients', $recipients, $email);
|
1806 |
+
if (count($recipients) == 0) {
|
1807 |
+
DebugEcho("postie_email_reject: no recipients after postie_email_reject_recipients filter");
|
1808 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1809 |
}
|
1810 |
|
1811 |
+
$subject = $blogname . ": Unauthorized Post Attempt from $from";
|
1812 |
+
$subject = apply_filter('postie_email_reject_subject', $subject, $email);
|
1813 |
|
1814 |
+
$message = apply_filter('postie_email_reject_body', $message, $email);
|
1815 |
+
|
1816 |
+
$attachTxt = wp_tempnam() . '.txt';
|
1817 |
+
file_put_contents($attachTxt, $email['text']);
|
1818 |
+
|
1819 |
+
$attachHtml = wp_tempnam() . '.htm';
|
1820 |
+
file_put_contents($attachHtml, $email['html']);
|
1821 |
+
|
1822 |
+
wp_mail($recipients, $subject, $message, $headers, array($attachTxt, $attachHtml));
|
1823 |
+
|
1824 |
+
unlink($attachTxt);
|
1825 |
+
unlink($attachHtml);
|
1826 |
}
|
1827 |
|
1828 |
/**
|
2038 |
return $content;
|
2039 |
}
|
2040 |
|
2041 |
+
function filter_ReplaceInlineImage($content, &$email, $config) {
|
2042 |
DebugEcho('filter_ReplaceInlineImage: start');
|
2043 |
foreach ($email['inline'] as &$inlineImage) {
|
2044 |
+
if (($inlineImage['primary'] == 'image' && $config['auto_gallery']) || $config['custom_image_field']) {
|
2045 |
+
//remove inline placeholder if we're not showing the image here
|
2046 |
+
DebugEcho('filter_ReplaceInlineImage: do not add inline due to config');
|
2047 |
+
$template = '';
|
2048 |
+
} else {
|
2049 |
+
$template = $inlineImage['template'];
|
2050 |
+
}
|
2051 |
+
$inlinemarker = '<:inline ' . $inlineImage['filename'] . ' inline:>';
|
2052 |
+
if (false !== strpos($content, $inlinemarker)) {
|
2053 |
DebugEcho('filter_ReplaceInlineImage: ' . $inlineImage['filename']);
|
2054 |
+
$content = str_ireplace($inlinemarker, $template, $content);
|
2055 |
+
$inlineImage['exclude'] = !empty($template); //don't exclude if we didn't add
|
2056 |
} else {
|
2057 |
DebugEcho('filter_ReplaceInlineImage: not found: ' . $inlineImage['filename']);
|
2058 |
}
|
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Postie
|
5 |
Plugin URI: http://PostiePlugin.com/
|
6 |
Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
|
7 |
-
Version: 1.8.
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL2
|
@@ -28,7 +28,7 @@
|
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
-
$Id: postie.php
|
32 |
*/
|
33 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
|
34 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
|
@@ -49,7 +49,7 @@ require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/pPop3MailServer.php"
|
|
49 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
|
50 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
|
51 |
|
52 |
-
define('POSTIE_VERSION', '1.8.
|
53 |
define("POSTIE_ROOT", dirname(__FILE__));
|
54 |
define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
55 |
|
4 |
Plugin Name: Postie
|
5 |
Plugin URI: http://PostiePlugin.com/
|
6 |
Description: Create posts via email. Significantly upgrades the Post by Email features of WordPress.
|
7 |
+
Version: 1.8.8
|
8 |
Author: Wayne Allen
|
9 |
Author URI: http://PostiePlugin.com/
|
10 |
License: GPL2
|
28 |
*/
|
29 |
|
30 |
/*
|
31 |
+
$Id: postie.php 1519553 2016-10-21 21:38:29Z WayneAllen $
|
32 |
*/
|
33 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fException.php");
|
34 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib/fUnexpectedException.php");
|
49 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "lib_autolink.php");
|
50 |
require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . "postie-functions.php");
|
51 |
|
52 |
+
define('POSTIE_VERSION', '1.8.8');
|
53 |
define("POSTIE_ROOT", dirname(__FILE__));
|
54 |
define("POSTIE_URL", WP_PLUGIN_URL . '/' . basename(dirname(__FILE__)));
|
55 |
|
@@ -6,7 +6,7 @@ Plugin URI: http://PostiePlugin.com/
|
|
6 |
Tags: e-mail, email, post-by-email
|
7 |
Requires at least: 3.3.0
|
8 |
Tested up to: 4.6.1
|
9 |
-
Stable tag: 1.8.
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
@@ -240,30 +240,42 @@ All script, style and body tags are stripped from html emails.
|
|
240 |
Attachments are now processed in the order they were attached.
|
241 |
|
242 |
== CHANGELOG ==
|
243 |
-
= 1.8.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
* Make code compatible with PHP 5.2
|
245 |
* Fix bug where the connection tried to use TLS even though it shouldn't
|
246 |
* Switch to stream API vs sockets since sockets don't seem to be installed typically and the stream API is core.
|
247 |
* Allow self signed certificates with socket connections
|
248 |
* Don't check peer name with socket connections, many hosting companies aren't configured correctly
|
249 |
|
250 |
-
|
251 |
-
= 1.8.6 (2016-10-19)
|
252 |
* Fix bug where the featured image was not included even though config said it should be.
|
253 |
* Ensure Socket connections try to connect with TLS 1.0, 1.1 and 1.2 if SSL is specified.
|
254 |
* Additional logging to help diagnose cURL issue.
|
255 |
|
256 |
-
= 1.8.5 (2016-10-18)
|
257 |
* Fix to check if cURL is installed before using
|
258 |
|
259 |
-
= 1.8.4 (2016-10-17)
|
260 |
* General release
|
261 |
|
262 |
-
= 1.8.3 (beta 4)
|
263 |
* Refactor attachment handling
|
264 |
* Gallery shortcode handling is now correct when there are both images and non-images.
|
265 |
|
266 |
-
= 1.8.2 (beta 3)
|
267 |
* New icon set thanks to Chris Lacey
|
268 |
* php-imap replaced by cURL and Socket connection - work sponsored by xsell.net
|
269 |
* TLS automatically detected, setting removed
|
@@ -279,9 +291,9 @@ Attachments are now processed in the order they were attached.
|
|
279 |
* New option: Text fallback. Falls back to plain if html is blank and vice versa.
|
280 |
* Support removing featured image from html
|
281 |
|
282 |
-
= 1.8.1 (beta 2)
|
283 |
|
284 |
-
= 1.8.0 (beta 1)
|
285 |
|
286 |
= 1.7.32 (2016-04-15) =
|
287 |
* Deal with incorrectly formatted date headers
|
6 |
Tags: e-mail, email, post-by-email
|
7 |
Requires at least: 3.3.0
|
8 |
Tested up to: 4.6.1
|
9 |
+
Stable tag: 1.8.8
|
10 |
License: GPLv2 or later
|
11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
|
240 |
Attachments are now processed in the order they were attached.
|
241 |
|
242 |
== CHANGELOG ==
|
243 |
+
= 1.8.8 (2016-10-21) =
|
244 |
+
* Fix bug where success/fail email notifications had missing info.
|
245 |
+
* Fix bug where galley wan't being inserted on some plain text messages
|
246 |
+
* Enhance auto linkification to recognize links like <http://example.com/>
|
247 |
+
* Separate success and failure emails.
|
248 |
+
* Fix readme
|
249 |
+
* New filter: postie_email_reject_recipients - allows recipients list to be altered when sending failure message
|
250 |
+
* New filter: postie_email_reject_subject - allows the subject to be altered when sending failure message
|
251 |
+
* New filter: postie_email_reject_body - allows message content to be altered when sending failure message
|
252 |
+
* New filter: postie_email_notify_recipients - allows recipients list to be altered when sending success message
|
253 |
+
* New filter: postie_email_notify_subject - allows the subject to be altered when sending success message
|
254 |
+
* New filter: postie_email_notify_body - allows message content to be altered when sending success message
|
255 |
+
|
256 |
+
= 1.8.7 (2016-10-20) =
|
257 |
* Make code compatible with PHP 5.2
|
258 |
* Fix bug where the connection tried to use TLS even though it shouldn't
|
259 |
* Switch to stream API vs sockets since sockets don't seem to be installed typically and the stream API is core.
|
260 |
* Allow self signed certificates with socket connections
|
261 |
* Don't check peer name with socket connections, many hosting companies aren't configured correctly
|
262 |
|
263 |
+
= 1.8.6 (2016-10-19) =
|
|
|
264 |
* Fix bug where the featured image was not included even though config said it should be.
|
265 |
* Ensure Socket connections try to connect with TLS 1.0, 1.1 and 1.2 if SSL is specified.
|
266 |
* Additional logging to help diagnose cURL issue.
|
267 |
|
268 |
+
= 1.8.5 (2016-10-18) =
|
269 |
* Fix to check if cURL is installed before using
|
270 |
|
271 |
+
= 1.8.4 (2016-10-17) =
|
272 |
* General release
|
273 |
|
274 |
+
= 1.8.3 (beta 4) =
|
275 |
* Refactor attachment handling
|
276 |
* Gallery shortcode handling is now correct when there are both images and non-images.
|
277 |
|
278 |
+
= 1.8.2 (beta 3) =
|
279 |
* New icon set thanks to Chris Lacey
|
280 |
* php-imap replaced by cURL and Socket connection - work sponsored by xsell.net
|
281 |
* TLS automatically detected, setting removed
|
291 |
* New option: Text fallback. Falls back to plain if html is blank and vice versa.
|
292 |
* Support removing featured image from html
|
293 |
|
294 |
+
= 1.8.1 (beta 2) =
|
295 |
|
296 |
+
= 1.8.0 (beta 1) =
|
297 |
|
298 |
= 1.7.32 (2016-04-15) =
|
299 |
* Deal with incorrectly formatted date headers
|