Skip to content

[v1.20.0] Convert newlines to line breaks when forcing HTML #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.20.0]
- Convert newlines to line breaks when forcing HTML

## [1.19.1]
- Fix warning when logging sends with a null To address

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ The plugin supports using the `wp_mail_from_name` filter for manually setting a
[Can I use the ActiveCampaign Postmark for WordPress plugin with Divi contact forms?](https://postmarkapp.com/support/article/1128-can-i-use-the-postmark-for-wordpress-plugin-with-divi-contact-forms)

## Changelog
## [1.19.1]
- Fix warning when logging sends with a null To address
## [1.20.0]
- Convert newlines to line breaks when forcing HTML

--------

Expand Down
4 changes: 2 additions & 2 deletions postmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: ActiveCampaign Postmark (Official)
* Plugin URI: https://postmarkapp.com/
* Description: Overrides wp_mail to send emails through ActiveCampaign Postmark
* Version: 1.19.1
* Version: 1.20.0
* Requires PHP: 7.0
* Requires at least: 5.3
* Tested up to: 6.2
Expand Down Expand Up @@ -41,7 +41,7 @@ class Postmark_Mail {
*
* @var string
*/
public static $POSTMARK_VERSION = '1.19.1';
public static $POSTMARK_VERSION = '1.20.0';

/**
* ActiveCampaign Postmark Plugin Directory.
Expand Down
6 changes: 3 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: postmark, email, smtp, notifications, wp_mail, wildbit
Requires PHP: 7.0
Requires at least: 5.3
Tested up to: 6.2
Stable tag: 1.19.1
Stable tag: 1.20.0

The *officially-supported* ActiveCampaign Postmark plugin for Wordpress.

Expand Down Expand Up @@ -133,8 +133,8 @@ At [ActiveCampaign](https://www.activecampaign.com/?utm_source=postmark&utm_medi
1. ActiveCampaign Postmark WP Plugin Settings screen.

== Changelog ==
= v1.19.1 =
* Fix warning when logging sends with a null To address
= v1.20.0 =
* Convert newlines to line breaks when forcing HTML

--------

Expand Down
4 changes: 4 additions & 0 deletions wp-mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ function wp_mail( $to, $subject, $message, $headers = '', $attachments = array()
}

if ( 1 === (int) $settings['force_html'] || 'text/html' === $content_type || 1 === $track_opens ) {
# convert "/n" newlines in plain text to <br> tags in forced HTML
if ( 'text/plain' === $content_type ) {
$message = str_replace( "\n", "<br>", $message );
}
$body['HtmlBody'] = $message;
// The user really, truly wants this sent as HTML, don't send it as text, too.
// For historical reasons, we can't "force html" and "track opens" set both html and text bodies,
Expand Down