summaryrefslogtreecommitdiff
path: root/Postman/Postman-Mail
diff options
context:
space:
mode:
authoryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2019-05-20 05:21:18 +0000
committeryehudah <yehudah@b8457f37-d9ea-0310-8a92-e5e31aec5664>2019-05-20 05:21:18 +0000
commitefd7b4d8d0d58f92e8080ffe2da669bb451b622b (patch)
tree35cb7ed64c1c7baa3c0c8045c68dc2d01fbb4b51 /Postman/Postman-Mail
parent7b06a0232e4dcb4be4a2b276f15f4a90903918b5 (diff)
downloadPost-SMTP-efd7b4d8d0d58f92e8080ffe2da669bb451b622b.zip
= 2.0.2 - 2019-05-19
* Fixed: Sendgrid code fix. * Fixed: Default method (nothing configured) will use the default mail on the server and not SMTP.
Diffstat (limited to 'Postman/Postman-Mail')
-rw-r--r--Postman/Postman-Mail/PostmanContactForm7.php2
-rw-r--r--Postman/Postman-Mail/PostmanModuleTransport.php5
-rw-r--r--Postman/Postman-Mail/PostmanSendGridMailEngine.php4
-rw-r--r--Postman/Postman-Mail/PostmanZendMailEngine.php4
-rw-r--r--Postman/Postman-Mail/Zend-1.12.10/Mail.php7
5 files changed, 14 insertions, 8 deletions
diff --git a/Postman/Postman-Mail/PostmanContactForm7.php b/Postman/Postman-Mail/PostmanContactForm7.php
index 64f4f5f..40fd698 100644
--- a/Postman/Postman-Mail/PostmanContactForm7.php
+++ b/Postman/Postman-Mail/PostmanContactForm7.php
@@ -13,7 +13,7 @@ class Postsmtp_ContactForm7 {
}
public function change_rest_response( $response ) {
- if ( $response['status'] == 'mail_failed' ) {
+ if ( array_key_exists('status', $response) && $response['status'] == 'mail_failed' ) {
$message = $this->result_error ['exception']->getMessage();
if ( ! $message || $message == '' ) {
diff --git a/Postman/Postman-Mail/PostmanModuleTransport.php b/Postman/Postman-Mail/PostmanModuleTransport.php
index 1dcc8b0..37d692d 100644
--- a/Postman/Postman-Mail/PostmanModuleTransport.php
+++ b/Postman/Postman-Mail/PostmanModuleTransport.php
@@ -503,6 +503,11 @@ abstract class PostmanAbstractZendModuleTransport extends PostmanAbstractModuleT
$deliveryDetails ['transport_name'] = $this->getTransportDescription ( $this->getSecurityType () );
$deliveryDetails ['host'] = $this->getHostname () . ':' . $this->getPort ();
$deliveryDetails ['auth_desc'] = $this->getAuthenticationDescription ( $this->getAuthenticationType () );
+
+ if ( $deliveryDetails ['host'] == 'localhost:25' ) {
+ $deliveryDetails ['transport_name'] = __( 'Sendmail (server defualt - not SMTP)', 'post-smtp');
+ }
+
/* translators: where (1) is the transport type, (2) is the host, and (3) is the Authentication Type (e.g. Postman will send mail via smtp.gmail.com:465 using OAuth 2.0 authentication.) */
return sprintf ( __ ( 'Postman will send mail via %1$s to %2$s using %3$s authentication.', 'post-smtp' ), '<b>' . $deliveryDetails ['transport_name'] . '</b>', '<b>' . $deliveryDetails ['host'] . '</b>', '<b>' . $deliveryDetails ['auth_desc'] . '</b>' );
}
diff --git a/Postman/Postman-Mail/PostmanSendGridMailEngine.php b/Postman/Postman-Mail/PostmanSendGridMailEngine.php
index b3e13b9..311d7cc 100644
--- a/Postman/Postman-Mail/PostmanSendGridMailEngine.php
+++ b/Postman/Postman-Mail/PostmanSendGridMailEngine.php
@@ -117,7 +117,7 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
$bccEmails = array();
foreach ( ( array ) $message->getBccRecipients() as $recipient ) {
$recipient->log($this->logger, 'Bcc');
- $bccEmails[] = new \SendGrid\Mail\Cc( $recipient->getEmail(), $recipient->getName() );
+ $bccEmails[] = new \SendGrid\Mail\Bcc( $recipient->getEmail(), $recipient->getName() );
}
$email->addBccs($bccEmails);
@@ -166,7 +166,7 @@ if ( ! class_exists( 'PostmanSendGridMailEngine' ) ) {
if ( isset( $response_body->errors[0]->message ) || ! $email_sent ) {
- $e = ! $email_sent ? $this->errorCodesMap($response_code) : $response_body->errors[0]->message;
+ $e = ! isset( $response_body->errors[0]->message ) ? $this->errorCodesMap($response_code) : $response_body->errors[0]->message;
$this->transcript = $e;
$this->transcript .= PostmanModuleTransport::RAW_MESSAGE_FOLLOWS;
$this->transcript .= print_r( $email, true );
diff --git a/Postman/Postman-Mail/PostmanZendMailEngine.php b/Postman/Postman-Mail/PostmanZendMailEngine.php
index e4ea286..86905f8 100644
--- a/Postman/Postman-Mail/PostmanZendMailEngine.php
+++ b/Postman/Postman-Mail/PostmanZendMailEngine.php
@@ -171,10 +171,12 @@ if ( ! class_exists( 'PostmanZendMailEngine' ) ) {
$this->logger->debug( 'Create the Zend_Mail transport' );
$zendTransport = $this->transport->createZendMailTransport( $this->transport->getHostname(), array() );
+ $transport = $this->transport instanceof PostmanDefaultModuleTransport ? null : $zendTransport;
+
try {
// send the message
$this->logger->debug( 'Sending mail' );
- $mail->send( $zendTransport );
+ $mail->send( $transport );
if ( $this->logger->isInfo() ) {
$this->logger->info( sprintf( 'Message %d accepted for delivery', PostmanState::getInstance()->getSuccessfulDeliveries() + 1 ) );
}
diff --git a/Postman/Postman-Mail/Zend-1.12.10/Mail.php b/Postman/Postman-Mail/Zend-1.12.10/Mail.php
index d597ea7..67ba4b9 100644
--- a/Postman/Postman-Mail/Zend-1.12.10/Mail.php
+++ b/Postman/Postman-Mail/Zend-1.12.10/Mail.php
@@ -1175,10 +1175,9 @@ class Postman_Zend_Mail extends Postman_Zend_Mime_Message
{
if ($transport === null) {
if (! self::$_defaultTransport instanceof Postman_Zend_Mail_Transport_Abstract) {
- require_once 'Zend/Mail/Transport/Sendmail.php';
-
- $replyTo = self::getDefaultReplyTo();
- $transport = new Postman_Zend_Mail_Transport_Sendmail("-f{$replyTo['email']}");
+ require_once 'Mail/Transport/Sendmail.php';
+
+ $transport = new Postman_Zend_Mail_Transport_Sendmail("-f{$this->_from}");
} else {
$transport = self::$_defaultTransport;
}