Version 5.0.13
This commit is contained in:
1 parent
b89858b2ff
commit
5efe744c5f
1407 files changed
+69690
-30177
No files matched your search
@@ -404,7 +404,7 @@ abstract class Email
|
||||
*/
|
||||
public function getAdvertisement( string $type='html' ): string
|
||||
{
|
||||
if( $advertisement = Advertisement::loadForEmail( $this->advertisementParams ) )
|
||||
if( $this->type !== static::TYPE_TRANSACTIONAL and $advertisement = Advertisement::loadForEmail( $this->advertisementParams ) )
|
||||
{
|
||||
return $advertisement->toString( $type, $this );
|
||||
}
|
||||
@@ -1369,13 +1369,19 @@ abstract class Email
|
||||
/**
|
||||
* Makes HTML acceptable for use in emails
|
||||
*
|
||||
* @param string $text The text
|
||||
* @param string|null $text The text
|
||||
* @param Lang|null $language Language. If not provided, will use whatever is set in $this->language - provided for backwards compatibility with templates not sending one
|
||||
* @param int|null $truncate NULL to not truncate, (int) to truncate to (int) chars
|
||||
* @return string
|
||||
*/
|
||||
public function parseTextForEmail( string $text, Lang $language = NULL, int $truncate=NULL ): string
|
||||
public function parseTextForEmail( ?string $text, Lang $language = NULL, int $truncate=NULL ): string
|
||||
{
|
||||
/* Text might be null because Item::content() can return null */
|
||||
if( $text === null )
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( $language === NULL )
|
||||
{
|
||||
$language = $this->language;
|
||||
|
||||
@@ -16,7 +16,8 @@ use IPS\core\Advertisement;
|
||||
use IPS\core\extensions\core\CommunityEnhancements\SendGrid as SendGridIntegration;
|
||||
use IPS\Db;
|
||||
use IPS\Email;
|
||||
use IPS\Http\Request\Exception;
|
||||
use IPS\Http\Request\Exception as RequestException;
|
||||
use IPS\Email\Outgoing\Exception as EmailException;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Lang;
|
||||
use IPS\Member;
|
||||
@@ -71,7 +72,7 @@ class SendGrid extends Email
|
||||
* @param mixed $fromName The name the email should appear from. If NULL, default setting is used
|
||||
* @param array $additionalHeaders The name the email should appear from. If NULL, default setting is used
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws EmailException
|
||||
*/
|
||||
public function _send( mixed $to, mixed $cc=array(), mixed $bcc=array(), mixed $fromEmail = NULL, mixed $fromName = NULL, array $additionalHeaders = array() ) : void
|
||||
{
|
||||
@@ -129,7 +130,7 @@ class SendGrid extends Email
|
||||
$response = $this->_api( 'mail/send', $request );
|
||||
if ( isset( $response['errors'] ) )
|
||||
{
|
||||
throw new Exception( $response['errors'][0]['message'] );
|
||||
throw new EmailException( $response['errors'][0]['message'] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ class SendGrid extends Email
|
||||
{
|
||||
$response = $this->_api( 'mail/send', $request );
|
||||
}
|
||||
catch(Exception $e )
|
||||
catch(RequestException $e )
|
||||
{
|
||||
Db::i()->insert( 'core_mail_error_logs', array(
|
||||
'mlog_date' => time(),
|
||||
@@ -395,14 +396,13 @@ class SendGrid extends Email
|
||||
return $this->_api( 'scopes' );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse/Save email form settings
|
||||
*
|
||||
* @param array $values settings array
|
||||
* @return array
|
||||
*/
|
||||
public function saveSettings( array $values ): array
|
||||
/**
|
||||
* Parse/Save email form settings
|
||||
*
|
||||
* @param array $values settings array
|
||||
* @return array
|
||||
*/
|
||||
public static function processSettings( array $values ): array
|
||||
{
|
||||
if ( isset( $values['mail_method'] ) and $values['mail_method'] != 'sendgrid' and Settings::i()->sendgrid_use_for == 2 )
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ class Smtp extends Email
|
||||
}
|
||||
$recipientsForSmtp = array_unique( array_map( 'trim', $recipientsForSmtp ) );
|
||||
|
||||
if( empty( $additonalHeaders['Message-ID'] ) )
|
||||
if( empty( $additionalHeaders['Message-ID'] ) )
|
||||
{
|
||||
$additionalHeaders['Message-ID'] = $this->generateMessageId();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user