inboundnow / inbound-pro

Inbound Pro Plugin for WordPress - Landing Page Framework, Calls to Action Framework, Visitor Analytics & List Segmentation, Email Campaigns & Marketing Automation
https://www.inboundnow.com
31 stars 17 forks source link

Final character of "From Name" is being dropped on all email sent with Inbound Now Pro #193

Closed travispflanz closed 4 years ago

travispflanz commented 4 years ago

This is an issue I discovered months ago, but have been using a workaround of adding a period (.) at the end of the "From Name" (for automated emails, bulk emails, and direct emails to Leads)

Until now, I have been using Inbound Now Pro on websites with only a single Admin who needs to send emails to Leads. Now, I am building a site where multiple admins will be sending emails to Leads and sending newsletters.

I have tested this bug on ~8 fully functional established websites. All with the same results of the last character being dropped.

I created a brand new site with only the Inbound Now Pro plugin installed (using the default Twenty Twenty theme), and still got the same result. I then thought the problem could be with the web host - since all of these sites are hosted by the same company (SiteGround).

I spun up another new website (this time on Pantheon) with only the Inbound Now Pro plugin and I got the same results when sending an email to a Lead.

Screenshot of Lead > Direct Email - https://i.imgur.com/CmEbLI7.png Screenshot of email received in Gmail - https://i.imgur.com/uCddLaj.png

I also tested with a Yahoo! email address with the same results of the last "From Name" character being dropped.

klf6890 commented 4 years ago

This issue is present in anything sent via WordPress mail and is caused by a missing space so it seemed like a pull request may be overkill for. By just adding a simple space between the insertion of the from name and the from email on line 22 in core/mailer/classes/class.mailer.wpmail.php

Line should be:

$headers[] = 'From: '.self::$email['from_name'].' <'.self::$email['from_email'].'>';

Instead of:

$headers[] = 'From: '.self::$email['from_name'].'<'.self::$email['from_email'].'>';

Note the added space before the opening "<" of the from_email field. This seems to fix the issue of the last character being removed in the from name field.

travispflanz commented 4 years ago

Awesome! Thanks, @klf6890! Not being a dev, I looked at that file for a long time and couldn't figure it out (I usually can isolate the problem, even if I can't fix it). As well, I don't know why, but it never crossed my mind to explicitly mention that I was using WordPress mail (in combination with https://wordpress.org/plugins/send-emails-with-mandrill/) to send emails, not SparkPost.

I'm sure @atwellpub will appreciate the easy fix :)

atwellpub commented 4 years ago

@klf6890 @travispflanz

Thanks so much 🙌. Updating the code now.

travispflanz commented 4 years ago

Tested and working as expected! All the characters of the "From name" are now coming through in the email client.