Skip to content

Commit

Permalink
Added Plain Text Version
Browse files Browse the repository at this point in the history
  • Loading branch information
techjewel committed Jul 2, 2024
1 parent 7a97974 commit 3f8e15f
Show file tree
Hide file tree
Showing 15 changed files with 829 additions and 78 deletions.
18 changes: 18 additions & 0 deletions app/Functions/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ function fluentMailSend($to, $subject, $message, $headers = '', $attachments = a
$attachments = explode("\n", str_replace("\r\n", "\n", $attachments));
}


global $phpmailer;

// (Re)create it, if it's gone missing.
Expand Down Expand Up @@ -491,6 +492,17 @@ function fluentMailSend($to, $subject, $message, $headers = '', $attachments = a
// Set whether it's plaintext, depending on $content_type.
if ('text/html' === $content_type) {
$phpmailer->isHTML(true);

if (fluentMailSendMultiPartText()) {
$phpmailer->AltBody = (new \FluentMail\App\Services\Html2Text($message))->getText();

if ($phpmailer->AltBody) {
// Set multipart
$phpmailer->ContentType = 'multipart/alternative';
}

}

}

// If we don't have a charset from the input headers.
Expand Down Expand Up @@ -782,3 +794,9 @@ function fluentMailFuncCouldNotBeLoadedRecheckPluginsLoad()
update_option('active_plugins', $activePlugins, true);
}
}

function fluentMailSendMultiPartText()
{
$settings = fluentMailGetSettings();
return isset($settings['misc']['send_as_text']) && $settings['misc']['send_as_text'] == 'yes';
}
8 changes: 7 additions & 1 deletion app/Hooks/Handlers/AdminMenuHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,9 @@ public function getTrans()
'__GCP_API_INST' => __(sprintf('Please %s to create API keys on the Google Cloud Platform.', '<a target="_blank" rel="nofollow" href="https://fluentsmtp.com/docs/connect-gmail-or-google-workspace-emails-with-fluentsmtp/">' . __('check the documentation', 'fluent-smtp') . '</a>'), 'fluent-smtp'),
'__GCP_INTRO' => __(sprintf('Google API version has been upgraded. Please %s.', '<a target="_blank" rel="noopener" href="https://fluentsmtp.com/docs/connect-gmail-or-google-workspace-emails-with-fluentsmtp/">' . __('read the doc and upgrade your API connection', 'fluent-smtp') . '</a>'), 'fluent-smtp'),
'__MAILGUN_REGION' => __(sprintf('If you are operating under EU laws, you may be required to use EU region. %s.', '<a target="_blank" href="https://www.mailgun.com/regions">' . __('More information on Mailgun.com', 'fluent-smtp') . '</a>'), 'fluent-smtp'),
'__Email_TEXT_PART_Label' => __('Enable Multi-Part Plain Text version of your HTML Emails. This feature is in beta', 'fluent-smtp'),
'__PASSWORD_ENCRYPT_HELP' => __('This input will be securely encrypted using WP SALTS as encryption keys before save.', 'fluent-smtp'),
'__PASSWORD_ENCRYPT_TIP' => __('If you change your WordPress SALT Keys, this credential will become invalid. Please update this credential whenever the WP SALTS are modified.', 'fluent-smtp'),
'activate ' => __('activate ', 'fluent-smtp'),
'cancel' => __('cancel', 'fluent-smtp'),
'check the documentation first to create API keys at Microsoft' => __('check the documentation first to create API keys at Microsoft', 'fluent-smtp'),
Expand All @@ -762,7 +765,7 @@ public function getTrans()
'read the documentation here' => __('read the documentation here', 'fluent-smtp'),
'save_connection_error_1' => __('Please select your email service provider', 'fluent-smtp'),
'save_connection_error_2' => __('Credential Verification Failed. Please check your inputs', 'fluent-smtp'),
'write a review for FluentSMTP' => __('write a review for FluentSMTP', 'fluent-smtp')
'write a review for FluentSMTP' => __('write a review for FluentSMTP', 'fluent-smtp'),
];
}

Expand Down Expand Up @@ -828,6 +831,9 @@ public function reservedTransShorts()
// 'save_connection_error_2' => __('Credential Verification Failed. Please check your inputs', 'fluent-smtp'),
// 'delete_logs_info' => __('Select how many days, the logs will be saved. If you select 7 days, then logs older than 7 days will be deleted automatically.', 'fluent-smtp'),
// 'force_sender_tooltip' => __('When checked, the From Name setting above will be used for all emails, ignoring values set by other plugins.', 'fluent-smtp'),
// '__Email_TEXT_PART_Label' => __('Enable Multi-Part Plain Text version of your HTML Emails. This feature is in beta', 'fluent-smtp'),
// '__PASSWORD_ENCRYPT_HELP' => __('This input will be securely encrypted using WP SALTS as encryption keys before save.', 'fluent-smtp'),
// '__PASSWORD_ENCRYPT_TIP' => __('If you change your WordPress SALT Keys, this credential will become invalid. Please update this credential whenever the WP SALTS are modified.', 'fluent-smtp'),

// ];
}
Expand Down
Loading

0 comments on commit 3f8e15f

Please sign in to comment.