Version Description
- 2018-07-22
- Better support for secure delivery
- Support for constants auth (inside wp-config), check the detailes our Blog
- Automatic encryption select base on the port input - 25, 465, 587, 2525
Download this release
Release Info
| Developer | yehudah |
| Plugin | |
| Version | 1.9.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.8.9 to 1.9.0
- Postman/Postman-Mail/PostmanMessage.php +252 -0
- Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php +8 -1
- Postman/PostmanOptions.php +30 -4
- Postman/PostmanUtils.php +23 -0
- Postman/PostmanViewController.php +1 -1
- Postman/PostmanWpMail.php +12 -0
- postman-smtp.php +2 -2
- readme.txt +9 -4
Postman/Postman-Mail/PostmanMessage.php
CHANGED
|
@@ -51,6 +51,25 @@ if ( ! class_exists( 'PostmanMessage' ) ) {
|
|
| 51 |
$this->bccRecipients = array();
|
| 52 |
}
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
/**
|
| 55 |
*
|
| 56 |
* @return boolean
|
|
@@ -557,5 +576,238 @@ if ( ! class_exists( 'PostmanMessage' ) ) {
|
|
| 557 |
public function getAttachments() {
|
| 558 |
return $this->attachments;
|
| 559 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 560 |
}
|
| 561 |
}
|
| 51 |
$this->bccRecipients = array();
|
| 52 |
}
|
| 53 |
|
| 54 |
+
function __get( $name ) {
|
| 55 |
+
$message = __( '<code>%1$s</code> property of a <code>PostmanMessage</code> object is <strong>not supported</strong>. For now all of this class properties are private.', Postman::TEXT_DOMAIN );
|
| 56 |
+
|
| 57 |
+
if ( WP_DEBUG ) {
|
| 58 |
+
trigger_error( sprintf( $message, $name ) );
|
| 59 |
+
}
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
function __call($name, $args) {
|
| 63 |
+
$class = new ReflectionClass(__CLASS__);
|
| 64 |
+
$methods = $class->getMethods(ReflectionMethod::IS_PUBLIC);
|
| 65 |
+
|
| 66 |
+
$message = __( '<code>%1$s</code> method of a <code>PostmanMessage</code> object is <strong>not supported</strong>. Use one of the following methods <pre><code>%2$s</code></pre>', Postman::TEXT_DOMAIN );
|
| 67 |
+
|
| 68 |
+
if ( WP_DEBUG ) {
|
| 69 |
+
trigger_error( sprintf( $message, $name, print_r( $methods, true ) ) );
|
| 70 |
+
}
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
/**
|
| 74 |
*
|
| 75 |
* @return boolean
|
| 576 |
public function getAttachments() {
|
| 577 |
return $this->attachments;
|
| 578 |
}
|
| 579 |
+
|
| 580 |
+
/**
|
| 581 |
+
* @todo
|
| 582 |
+
* is this right? maybe extending the phpmailer class insted?
|
| 583 |
+
*/
|
| 584 |
+
|
| 585 |
+
/**
|
| 586 |
+
* Add an embedded (inline) attachment from a file.
|
| 587 |
+
* This can include images, sounds, and just about any other document type.
|
| 588 |
+
* These differ from 'regular' attachments in that they are intended to be
|
| 589 |
+
* displayed inline with the message, not just attached for download.
|
| 590 |
+
* This is used in HTML messages that embed the images
|
| 591 |
+
* the HTML refers to using the $cid value.
|
| 592 |
+
* Never use a user-supplied path to a file!
|
| 593 |
+
* @param string $path Path to the attachment.
|
| 594 |
+
* @param string $cid Content ID of the attachment; Use this to reference
|
| 595 |
+
* the content when using an embedded image in HTML.
|
| 596 |
+
* @param string $name Overrides the attachment name.
|
| 597 |
+
* @param string $encoding File encoding (see $Encoding).
|
| 598 |
+
* @param string $type File MIME type.
|
| 599 |
+
* @param string $disposition Disposition to use
|
| 600 |
+
* @return boolean True on successfully adding an attachment
|
| 601 |
+
*/
|
| 602 |
+
public function addEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = '', $disposition = 'inline') {
|
| 603 |
+
if (!@is_file($path)) {
|
| 604 |
+
return false;
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
// If a MIME type is not specified, try to work it out from the file name
|
| 608 |
+
if ($type == '') {
|
| 609 |
+
$type = self::filenameToType($path);
|
| 610 |
+
}
|
| 611 |
+
|
| 612 |
+
$filename = basename($path);
|
| 613 |
+
if ($name == '') {
|
| 614 |
+
$name = $filename;
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
// Append to $attachment array
|
| 618 |
+
$this->attachments[] = array(
|
| 619 |
+
0 => $path,
|
| 620 |
+
1 => $filename,
|
| 621 |
+
2 => $name,
|
| 622 |
+
3 => $encoding,
|
| 623 |
+
4 => $type,
|
| 624 |
+
5 => false, // isStringAttachment
|
| 625 |
+
6 => $disposition,
|
| 626 |
+
7 => $cid
|
| 627 |
+
);
|
| 628 |
+
|
| 629 |
+
return true;
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
/**
|
| 633 |
+
* Get the MIME type for a file extension.
|
| 634 |
+
* @param string $ext File extension
|
| 635 |
+
* @access public
|
| 636 |
+
* @return string MIME type of file.
|
| 637 |
+
* @static
|
| 638 |
+
*/
|
| 639 |
+
public static function _mime_types($ext = '')
|
| 640 |
+
{
|
| 641 |
+
$mimes = array(
|
| 642 |
+
'xl' => 'application/excel',
|
| 643 |
+
'js' => 'application/javascript',
|
| 644 |
+
'hqx' => 'application/mac-binhex40',
|
| 645 |
+
'cpt' => 'application/mac-compactpro',
|
| 646 |
+
'bin' => 'application/macbinary',
|
| 647 |
+
'doc' => 'application/msword',
|
| 648 |
+
'word' => 'application/msword',
|
| 649 |
+
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
| 650 |
+
'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template',
|
| 651 |
+
'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template',
|
| 652 |
+
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
|
| 653 |
+
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
| 654 |
+
'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide',
|
| 655 |
+
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
| 656 |
+
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
|
| 657 |
+
'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12',
|
| 658 |
+
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
| 659 |
+
'class' => 'application/octet-stream',
|
| 660 |
+
'dll' => 'application/octet-stream',
|
| 661 |
+
'dms' => 'application/octet-stream',
|
| 662 |
+
'exe' => 'application/octet-stream',
|
| 663 |
+
'lha' => 'application/octet-stream',
|
| 664 |
+
'lzh' => 'application/octet-stream',
|
| 665 |
+
'psd' => 'application/octet-stream',
|
| 666 |
+
'sea' => 'application/octet-stream',
|
| 667 |
+
'so' => 'application/octet-stream',
|
| 668 |
+
'oda' => 'application/oda',
|
| 669 |
+
'pdf' => 'application/pdf',
|
| 670 |
+
'ai' => 'application/postscript',
|
| 671 |
+
'eps' => 'application/postscript',
|
| 672 |
+
'ps' => 'application/postscript',
|
| 673 |
+
'smi' => 'application/smil',
|
| 674 |
+
'smil' => 'application/smil',
|
| 675 |
+
'mif' => 'application/vnd.mif',
|
| 676 |
+
'xls' => 'application/vnd.ms-excel',
|
| 677 |
+
'ppt' => 'application/vnd.ms-powerpoint',
|
| 678 |
+
'wbxml' => 'application/vnd.wap.wbxml',
|
| 679 |
+
'wmlc' => 'application/vnd.wap.wmlc',
|
| 680 |
+
'dcr' => 'application/x-director',
|
| 681 |
+
'dir' => 'application/x-director',
|
| 682 |
+
'dxr' => 'application/x-director',
|
| 683 |
+
'dvi' => 'application/x-dvi',
|
| 684 |
+
'gtar' => 'application/x-gtar',
|
| 685 |
+
'php3' => 'application/x-httpd-php',
|
| 686 |
+
'php4' => 'application/x-httpd-php',
|
| 687 |
+
'php' => 'application/x-httpd-php',
|
| 688 |
+
'phtml' => 'application/x-httpd-php',
|
| 689 |
+
'phps' => 'application/x-httpd-php-source',
|
| 690 |
+
'swf' => 'application/x-shockwave-flash',
|
| 691 |
+
'sit' => 'application/x-stuffit',
|
| 692 |
+
'tar' => 'application/x-tar',
|
| 693 |
+
'tgz' => 'application/x-tar',
|
| 694 |
+
'xht' => 'application/xhtml+xml',
|
| 695 |
+
'xhtml' => 'application/xhtml+xml',
|
| 696 |
+
'zip' => 'application/zip',
|
| 697 |
+
'mid' => 'audio/midi',
|
| 698 |
+
'midi' => 'audio/midi',
|
| 699 |
+
'mp2' => 'audio/mpeg',
|
| 700 |
+
'mp3' => 'audio/mpeg',
|
| 701 |
+
'mpga' => 'audio/mpeg',
|
| 702 |
+
'aif' => 'audio/x-aiff',
|
| 703 |
+
'aifc' => 'audio/x-aiff',
|
| 704 |
+
'aiff' => 'audio/x-aiff',
|
| 705 |
+
'ram' => 'audio/x-pn-realaudio',
|
| 706 |
+
'rm' => 'audio/x-pn-realaudio',
|
| 707 |
+
'rpm' => 'audio/x-pn-realaudio-plugin',
|
| 708 |
+
'ra' => 'audio/x-realaudio',
|
| 709 |
+
'wav' => 'audio/x-wav',
|
| 710 |
+
'bmp' => 'image/bmp',
|
| 711 |
+
'gif' => 'image/gif',
|
| 712 |
+
'jpeg' => 'image/jpeg',
|
| 713 |
+
'jpe' => 'image/jpeg',
|
| 714 |
+
'jpg' => 'image/jpeg',
|
| 715 |
+
'png' => 'image/png',
|
| 716 |
+
'tiff' => 'image/tiff',
|
| 717 |
+
'tif' => 'image/tiff',
|
| 718 |
+
'eml' => 'message/rfc822',
|
| 719 |
+
'css' => 'text/css',
|
| 720 |
+
'html' => 'text/html',
|
| 721 |
+
'htm' => 'text/html',
|
| 722 |
+
'shtml' => 'text/html',
|
| 723 |
+
'log' => 'text/plain',
|
| 724 |
+
'text' => 'text/plain',
|
| 725 |
+
'txt' => 'text/plain',
|
| 726 |
+
'rtx' => 'text/richtext',
|
| 727 |
+
'rtf' => 'text/rtf',
|
| 728 |
+
'vcf' => 'text/vcard',
|
| 729 |
+
'vcard' => 'text/vcard',
|
| 730 |
+
'xml' => 'text/xml',
|
| 731 |
+
'xsl' => 'text/xml',
|
| 732 |
+
'mpeg' => 'video/mpeg',
|
| 733 |
+
'mpe' => 'video/mpeg',
|
| 734 |
+
'mpg' => 'video/mpeg',
|
| 735 |
+
'mov' => 'video/quicktime',
|
| 736 |
+
'qt' => 'video/quicktime',
|
| 737 |
+
'rv' => 'video/vnd.rn-realvideo',
|
| 738 |
+
'avi' => 'video/x-msvideo',
|
| 739 |
+
'movie' => 'video/x-sgi-movie'
|
| 740 |
+
);
|
| 741 |
+
if (array_key_exists(strtolower($ext), $mimes)) {
|
| 742 |
+
return $mimes[strtolower($ext)];
|
| 743 |
+
}
|
| 744 |
+
return 'application/octet-stream';
|
| 745 |
+
}
|
| 746 |
+
|
| 747 |
+
/**
|
| 748 |
+
* Map a file name to a MIME type.
|
| 749 |
+
* Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
|
| 750 |
+
* @param string $filename A file name or full path, does not need to exist as a file
|
| 751 |
+
* @return string
|
| 752 |
+
* @static
|
| 753 |
+
*/
|
| 754 |
+
public static function filenameToType($filename)
|
| 755 |
+
{
|
| 756 |
+
// In case the path is a URL, strip any query string before getting extension
|
| 757 |
+
$qpos = strpos($filename, '?');
|
| 758 |
+
if (false !== $qpos) {
|
| 759 |
+
$filename = substr($filename, 0, $qpos);
|
| 760 |
+
}
|
| 761 |
+
$pathinfo = self::mb_pathinfo($filename);
|
| 762 |
+
return self::_mime_types($pathinfo['extension']);
|
| 763 |
+
}
|
| 764 |
+
|
| 765 |
+
/**
|
| 766 |
+
* Multi-byte-safe pathinfo replacement.
|
| 767 |
+
* Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
|
| 768 |
+
* Works similarly to the one in PHP >= 5.2.0
|
| 769 |
+
* @link http://www.php.net/manual/en/function.pathinfo.php#107461
|
| 770 |
+
* @param string $path A filename or path, does not need to exist as a file
|
| 771 |
+
* @param integer|string $options Either a PATHINFO_* constant,
|
| 772 |
+
* or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
|
| 773 |
+
* @return string|array
|
| 774 |
+
* @static
|
| 775 |
+
*/
|
| 776 |
+
public static function mb_pathinfo($path, $options = null)
|
| 777 |
+
{
|
| 778 |
+
$ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
|
| 779 |
+
$pathinfo = array();
|
| 780 |
+
if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
|
| 781 |
+
if (array_key_exists(1, $pathinfo)) {
|
| 782 |
+
$ret['dirname'] = $pathinfo[1];
|
| 783 |
+
}
|
| 784 |
+
if (array_key_exists(2, $pathinfo)) {
|
| 785 |
+
$ret['basename'] = $pathinfo[2];
|
| 786 |
+
}
|
| 787 |
+
if (array_key_exists(5, $pathinfo)) {
|
| 788 |
+
$ret['extension'] = $pathinfo[5];
|
| 789 |
+
}
|
| 790 |
+
if (array_key_exists(3, $pathinfo)) {
|
| 791 |
+
$ret['filename'] = $pathinfo[3];
|
| 792 |
+
}
|
| 793 |
+
}
|
| 794 |
+
switch ($options) {
|
| 795 |
+
case PATHINFO_DIRNAME:
|
| 796 |
+
case 'dirname':
|
| 797 |
+
return $ret['dirname'];
|
| 798 |
+
case PATHINFO_BASENAME:
|
| 799 |
+
case 'basename':
|
| 800 |
+
return $ret['basename'];
|
| 801 |
+
case PATHINFO_EXTENSION:
|
| 802 |
+
case 'extension':
|
| 803 |
+
return $ret['extension'];
|
| 804 |
+
case PATHINFO_FILENAME:
|
| 805 |
+
case 'filename':
|
| 806 |
+
return $ret['filename'];
|
| 807 |
+
default:
|
| 808 |
+
return $ret;
|
| 809 |
+
}
|
| 810 |
+
}
|
| 811 |
+
|
| 812 |
}
|
| 813 |
}
|
Postman/Postman-Mail/Zend-1.12.10/Mail/Protocol/Smtp.php
CHANGED
|
@@ -208,7 +208,14 @@ class Postman_Zend_Mail_Protocol_Smtp extends Postman_Zend_Mail_Protocol_Abstrac
|
|
| 208 |
stream_context_set_option($this->_socket, 'ssl', 'verify_peer_name', false);
|
| 209 |
stream_context_set_option($this->_socket, 'ssl', 'allow_self_signed', true);
|
| 210 |
|
| 211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
/**
|
| 213 |
* @see Postman_Zend_Mail_Protocol_Exception
|
| 214 |
*/
|
| 208 |
stream_context_set_option($this->_socket, 'ssl', 'verify_peer_name', false);
|
| 209 |
stream_context_set_option($this->_socket, 'ssl', 'allow_self_signed', true);
|
| 210 |
|
| 211 |
+
$crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
|
| 212 |
+
|
| 213 |
+
if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
|
| 214 |
+
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
|
| 215 |
+
$crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
if (!stream_socket_enable_crypto($this->_socket, true, $crypto_method)) {
|
| 219 |
/**
|
| 220 |
* @see Postman_Zend_Mail_Protocol_Exception
|
| 221 |
*/
|
Postman/PostmanOptions.php
CHANGED
|
@@ -260,16 +260,42 @@ if ( ! class_exists( 'PostmanOptions' ) ) {
|
|
| 260 |
return $this->options [ PostmanOptions::AUTHENTICATION_TYPE ]; }
|
| 261 |
}
|
| 262 |
public function getEncryptionType() {
|
| 263 |
-
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
}
|
| 266 |
public function getUsername() {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
if ( isset( $this->options [ PostmanOptions::BASIC_AUTH_USERNAME ] ) ) {
|
| 268 |
-
return $this->options [ PostmanOptions::BASIC_AUTH_USERNAME ];
|
|
|
|
| 269 |
}
|
| 270 |
public function getPassword() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
if ( isset( $this->options [ PostmanOptions::BASIC_AUTH_PASSWORD ] ) ) {
|
| 272 |
-
return base64_decode( $this->options [ PostmanOptions::BASIC_AUTH_PASSWORD ] );
|
|
|
|
| 273 |
}
|
| 274 |
public function getMandrillApiKey() {
|
| 275 |
if ( isset( $this->options [ PostmanOptions::MANDRILL_API_KEY ] ) ) {
|
| 260 |
return $this->options [ PostmanOptions::AUTHENTICATION_TYPE ]; }
|
| 261 |
}
|
| 262 |
public function getEncryptionType() {
|
| 263 |
+
$port = $this->getPort();
|
| 264 |
+
switch ($port):
|
| 265 |
+
case 25:
|
| 266 |
+
return 'none';
|
| 267 |
+
break;
|
| 268 |
+
case 465:
|
| 269 |
+
return 'ssl';
|
| 270 |
+
break;
|
| 271 |
+
case 587:
|
| 272 |
+
return 'tls';
|
| 273 |
+
break;
|
| 274 |
+
case 2525:
|
| 275 |
+
return 'tls';
|
| 276 |
+
break;
|
| 277 |
+
default:
|
| 278 |
+
return isset( $this->options [ PostmanOptions::SECURITY_TYPE ] ) ? $this->options [ PostmanOptions::SECURITY_TYPE ] : 'none';
|
| 279 |
+
endswitch;
|
| 280 |
}
|
| 281 |
public function getUsername() {
|
| 282 |
+
if ( defined( POST_SMTP_AUTH_USERNAME ) ) {
|
| 283 |
+
return POST_SMTP_AUTH_USERNAME;
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
if ( isset( $this->options [ PostmanOptions::BASIC_AUTH_USERNAME ] ) ) {
|
| 287 |
+
return $this->options [ PostmanOptions::BASIC_AUTH_USERNAME ];
|
| 288 |
+
}
|
| 289 |
}
|
| 290 |
public function getPassword() {
|
| 291 |
+
|
| 292 |
+
if ( defined( POST_SMTP_AUTH_PASSWORD ) ) {
|
| 293 |
+
return POST_SMTP_AUTH_PASSWORD;
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
if ( isset( $this->options [ PostmanOptions::BASIC_AUTH_PASSWORD ] ) ) {
|
| 297 |
+
return base64_decode( $this->options [ PostmanOptions::BASIC_AUTH_PASSWORD ] );
|
| 298 |
+
}
|
| 299 |
}
|
| 300 |
public function getMandrillApiKey() {
|
| 301 |
if ( isset( $this->options [ PostmanOptions::MANDRILL_API_KEY ] ) ) {
|
Postman/PostmanUtils.php
CHANGED
|
@@ -452,6 +452,29 @@ class PostmanUtils {
|
|
| 452 |
$result = php_uname('n');
|
| 453 |
}
|
| 454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
return $result;
|
| 456 |
}
|
| 457 |
|
| 452 |
$result = php_uname('n');
|
| 453 |
}
|
| 454 |
|
| 455 |
+
if ( $result !== 'localhost.localdomain' ) {
|
| 456 |
+
// get the current result ip
|
| 457 |
+
$ip = gethostbyname($result);
|
| 458 |
+
|
| 459 |
+
// dns query failed
|
| 460 |
+
if ( $ip == $result ) {
|
| 461 |
+
return $result;
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
// get the current ip hostname - reverse dns
|
| 465 |
+
$host = gethostbyaddr($ip);
|
| 466 |
+
|
| 467 |
+
// dns query failed
|
| 468 |
+
if ( $host == $ip ) {
|
| 469 |
+
return $result;
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
// if hostname is not equal to the result set the ptr
|
| 473 |
+
if ( $result !== $host ) {
|
| 474 |
+
$result = $host;
|
| 475 |
+
}
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
return $result;
|
| 479 |
}
|
| 480 |
|
Postman/PostmanViewController.php
CHANGED
|
@@ -307,7 +307,7 @@ if ( ! class_exists( 'PostmanViewController' ) ) {
|
|
| 307 |
echo '
|
| 308 |
<div class="updated settings-error notice is-dismissible">
|
| 309 |
<p>
|
| 310 |
-
<strong>Version ' . $version . ' released with
|
| 311 |
</p>
|
| 312 |
<button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
|
| 313 |
<span class="screen-reader-text">Dismiss this notice.</span>
|
| 307 |
echo '
|
| 308 |
<div class="updated settings-error notice is-dismissible">
|
| 309 |
<p>
|
| 310 |
+
<strong>Version ' . $version . ' released with better compability for secure ports:</strong> <a target="_blank" href="https://postmansmtp.com/post-smtp-1-9-0-better-support-for-secure-delivery">Read Here</a>
|
| 311 |
</p>
|
| 312 |
<button style="z-index: 100;" data-version="'. $version . '" data-security="' . wp_create_nonce('postsmtp') .'" type="button" class="notice-dismiss postman-release-message">
|
| 313 |
<span class="screen-reader-text">Dismiss this notice.</span>
|
Postman/PostmanWpMail.php
CHANGED
|
@@ -166,6 +166,7 @@ if ( ! class_exists( 'PostmanWpMail' ) ) {
|
|
| 166 |
// apply the WordPress filters
|
| 167 |
// may impact the from address, from email, charset and content-type
|
| 168 |
$message->applyFilters();
|
|
|
|
| 169 |
|
| 170 |
// create the body parts (if they are both missing)
|
| 171 |
if ( $message->isBodyPartsEmpty() ) {
|
|
@@ -234,6 +235,17 @@ if ( ! class_exists( 'PostmanWpMail' ) ) {
|
|
| 234 |
PostmanEmailLogService::getInstance()->writeFailureLog( $log, $message, $engine->getTranscript(), $transport, $e->getMessage() );
|
| 235 |
}
|
| 236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
// return failure
|
| 238 |
return false;
|
| 239 |
}
|
| 166 |
// apply the WordPress filters
|
| 167 |
// may impact the from address, from email, charset and content-type
|
| 168 |
$message->applyFilters();
|
| 169 |
+
do_action_ref_array( 'phpmailer_init', array( &$message ) );
|
| 170 |
|
| 171 |
// create the body parts (if they are both missing)
|
| 172 |
if ( $message->isBodyPartsEmpty() ) {
|
| 235 |
PostmanEmailLogService::getInstance()->writeFailureLog( $log, $message, $engine->getTranscript(), $transport, $e->getMessage() );
|
| 236 |
}
|
| 237 |
|
| 238 |
+
$mail_error_data = array(
|
| 239 |
+
'to' => $message->getToRecipients(),
|
| 240 |
+
'subject' => $message->getSubject(),
|
| 241 |
+
'message' => $message->getBody(),
|
| 242 |
+
'headers' => $message->getHeaders(),
|
| 243 |
+
'attachments' => $message->getAttachments()
|
| 244 |
+
);
|
| 245 |
+
$mail_error_data['phpmailer_exception_code'] = $e->getCode();
|
| 246 |
+
|
| 247 |
+
do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
|
| 248 |
+
|
| 249 |
// return failure
|
| 250 |
return false;
|
| 251 |
}
|
postman-smtp.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
* Plugin Name: Post SMTP
|
| 5 |
* Plugin URI: https://wordpress.org/plugins/post-smtp/
|
| 6 |
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
|
| 7 |
-
* Version: 1.
|
| 8 |
* Author: Jason Hendriks, Yehuda Hassine
|
| 9 |
* Text Domain: post-smtp
|
| 10 |
* Author URI: https://postmansmtp.com
|
|
@@ -123,5 +123,5 @@ function post_start( $startingMemory ) {
|
|
| 123 |
*/
|
| 124 |
function post_setupPostman() {
|
| 125 |
require_once 'Postman/Postman.php';
|
| 126 |
-
$kevinCostner = new Postman( __FILE__, '1.
|
| 127 |
}
|
| 4 |
* Plugin Name: Post SMTP
|
| 5 |
* Plugin URI: https://wordpress.org/plugins/post-smtp/
|
| 6 |
* Description: Email not reliable? Post SMTP is the first and only WordPress SMTP plugin to implement OAuth 2.0 for Gmail, Hotmail and Yahoo Mail. Setup is a breeze with the Configuration Wizard and integrated Port Tester. Enjoy worry-free delivery even if your password changes!
|
| 7 |
+
* Version: 1.9.0
|
| 8 |
* Author: Jason Hendriks, Yehuda Hassine
|
| 9 |
* Text Domain: post-smtp
|
| 10 |
* Author URI: https://postmansmtp.com
|
| 123 |
*/
|
| 124 |
function post_setupPostman() {
|
| 125 |
require_once 'Postman/Postman.php';
|
| 126 |
+
$kevinCostner = new Postman( __FILE__, '1.9.0' );
|
| 127 |
}
|
readme.txt
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
=== Post SMTP Mailer/Email Log ===
|
| 2 |
-
Contributors: yehudah, abdullahramzan,
|
| 3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@myinbox.in&item_name=Donation+for+PostSMTP
|
| 4 |
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.9.5
|
| 7 |
-
Stable tag: 1.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -12,8 +12,8 @@ Send, log and troubleshoot your Outgoing Email easily. Supports everything: SMTP
|
|
| 12 |
|
| 13 |
== Description ==
|
| 14 |
|
| 15 |
-
= Version 1.
|
| 16 |
-
|
| 17 |
|
| 18 |
= WordPress Mail SMTP Plugin =
|
| 19 |
|
|
@@ -296,6 +296,11 @@ To avoid being flagged as spam, you need to prove your email isn't forged. On a
|
|
| 296 |
|
| 297 |
|
| 298 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
= 1.8.9 - 2018-04-24
|
| 300 |
* Sendgrid bug
|
| 301 |
|
| 1 |
=== Post SMTP Mailer/Email Log ===
|
| 2 |
+
Contributors: yehudah, abdullahramzan ,jasonhendriks
|
| 3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yehuda@myinbox.in&item_name=Donation+for+PostSMTP
|
| 4 |
Tags: postman smtp, postman, smtp, email, mail, mailer, email log, oauth2, gmail, google apps, hotmail, yahoo, mandrill api, sendgrid api, elastic email, office365, mailgun
|
| 5 |
Requires at least: 3.9
|
| 6 |
Tested up to: 4.9.5
|
| 7 |
+
Stable tag: 1.9.0
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 12 |
|
| 13 |
== Description ==
|
| 14 |
|
| 15 |
+
= Version 1.9.0 released =
|
| 16 |
+
Better secure delivery and external auth credentials (wp-config). [Read the detailes here](https://postmansmtp.com/post-smtp-1-9-0-better-support-for-secure-delivery/)
|
| 17 |
|
| 18 |
= WordPress Mail SMTP Plugin =
|
| 19 |
|
| 296 |
|
| 297 |
|
| 298 |
== Changelog ==
|
| 299 |
+
= 1.9.0 - 2018-07-22
|
| 300 |
+
* Better support for secure delivery
|
| 301 |
+
* Support for constants auth (inside wp-config), check the detailes our [Blog](https://postmansmtp.com/post-smtp-1-9-0-better-support-for-secure-delivery)
|
| 302 |
+
* Automatic encryption select base on the port input - 25, 465, 587, 2525
|
| 303 |
+
|
| 304 |
= 1.8.9 - 2018-04-24
|
| 305 |
* Sendgrid bug
|
| 306 |
|
