Linebreaks Missing
-
Hello,
I am using this plugin to send all emails via sendgrid. My main plugin is memberpress. All the notification emails have been missing linebreaks. I have tested the mail settings in sendgrid account and plugin settings as well.
Nothing helps. All the linebreaks with \n \n are missing.
Thanks
-
Hi @dhirnitish,
Please enable the ‘Plain Content’ option from your account’s settings ( https://app.sendgrid.com/settings/mail_settings ) and see if it works this way. Unfortunately we can’t test that very plugin to see the compatibility.
Please keep us posted.
Thank you,
SendGridHello,
I have enabled the option already. Its not just with that plugins but everything. Every single email that goes out of my site is missing linebreaks.
Thanks
Hello,
We can’t reproduce your issue. Please let us know what other plugins are you using to see if there is a incompatibility.
Thank you,
SendGridI too have the same issue, it’s completely stripping the P tag
It happens to all emails WordPress & plugin alike. So instead of getting the layout here where I have the dropline I am getting something like the below.
“I too have the same issue, it’s completely stripping the P tag It happens to all emails WordPress & plugin alike. So instead of getting the layout here where I have the dropline I am getting something like the below.”
@team-rs Its very unlikely that you were not able to reproduce the issue. Well i made a code change and it fixed things for me.
The change has been done in the following file:
/lib/sendgrid/class-sendgrid-api.php$fields['html'] = nl2br($fields['html']);Add the above line on line number 28. Maybe you guys can integrate it with a checkbox in the settings for all the people who face this issue. Because there are a lot!
For purposes of debugging:
WordPress Version: 4.6.1
PHP: 7.0.13
Error Log: Clear
Content-Type: text/html
SendGrid: Latest
Other plugins: Tested both with and without plugins
Theme: KLEO, also tested with Twenty Sixteen, Twenty Fifteen and Twenty Fourteen
Sending through email test: Respects the HTML used, b p i etc.
Other: Test with “Plain Content” on in settings, no change.@naughtybiscuit Try the change i made. It works well for me.
Hi @dhirnitish,
I hadn’t seen your reply at the time I pressed submit, I am about to try it now. To confirm insert
$fields['html'] = nl2br($fields['html']);above line 28, so it should look likepublic function send(SendGrid\Email $email) { $fields = $email->toWebFormat(); $fields['html'] = nl2br($fields['html']); $headers = array();Is that correct?
Yes @naughtybiscuit
Worked like an absolute charm! Thank you so much @dhirnitish for saving me a few hours of looking through the code.
I do find it hard to believe, given the amount of open tickets about this that SendGrid were unable to replicate the issue :/
Kieran.
I am glad i could help. I just wish they could push this in their coming updates.
Hi,
Thank you for suggesting that line, but we can’t have it in our code since that will break other emails (html). We will keep investigating the issue and try to come with a fix for you!
Thanks,
SendGrid@team-rs All the emails work fine after adding that line.You can include an on off switch for it in the settings page if needed.
Thanks
NitishI came here to report this exact issue with me as well.
@dhirnitish, are you saying you’re able to send HTML emails as well with no issue with your fix? I’m concerned by @team-rs’s response about HTML emails.
@team-rs, I reported this to your support team and received a pretty lame reply (“It’s WordPress..contact them.”). I hope you’re able to resolve this soon. Thanks for your help.
@toddcav as far as i can remember, its still working good for me. You can try it forsure and comment it out if it does not do the right job for you.
Thanks
The topic ‘Linebreaks Missing’ is closed to new replies.