Post by email formatting

  • Unknown's avatar

    I am having two problems when posting by email.

    • One is that line breaks aren’t coming through when I type the text into an email, but they do show up in the post when I paste a paragraph from Google Docs into the email.
    • Is it possible to create a button with a link when sending a post by email? I tried using this but it just showed up as written: text goes here
  • Unknown's avatar

    That button link was meant to look like this: <a class="button" href="https://InsertWebsiteHere/">text goes here</a>

  • Hello there,

    Happy to help you with this.

    One is that line breaks aren’t coming through when I type the text into an email, but they do show up in the post when I paste a paragraph from Google Docs into the email.

    Hmm, are you adding any soft returns, rather than hard returns when creating the post via email?

    Are you able to provide us a link to the post where this is happening so that we can take a look please.

    Is it possible to create a button with a link when sending a post by email? I tried using this but it just showed up as written: text goes here

    That would be expected as that HTML is a link, with a class assigned.

    You would need to add custom CSS to the site, so that when the “button” class is used, styling is applied.

    I hope this helps so far.

  • Unknown's avatar

    For the line breaks/paragraphs, I think it is an issue with the “latest posts” block that I am addressing in a different post. We can let that one be resolved there. Sorry for the mixup. I thought it was a post by email issue.

    For the button, I am not sure I understand. I am able to add that link to a post directly to create a button but not via email(see this post.) I am using the Blank Canvas theme. Is it because it won’t recognize html written into an email?

    Thank you.

  • Hi there,

    The HTML code is only applicable to the site. When you paste it into the email it doesn’t work. To create a button that will show up on the email you need to follow these instructions (inline code):

    https://www.copernica.com/en/blog/post/how-to-create-email-buttons-with-just-html-and-css

    However, those instructions are meant to create a button for newsletters and similar email messages. So, the button might look good on the email but not that good on your site.

  • Unknown's avatar

    Thank you. However, that didn’t work for me either. I need it to show up on the site, not the email. The email is just the method of posting. Would a shortcode or plugin work for this? I don’t have premium yet, but plan to upgrade if this idea will work.

    Ultimately what I am trying to achieve is posting via email without having to go into the post and add a button manually.
    Here is how it looks when I add a button manually.

    The process will look like this:

    • Google sheets document is updated
    • Google apps script creates an email with the updated information from the spreadsheet and sends it to the blog, including a button link code
    • WordPress receives the post by email and creates the post with a button link at the end
  • That’s a cool process!

    Do you have an example of a post that was created by email, included the button code, but the button did not appear?

    I’m curious is the HTML is getting stripped out along the way, or if other information is being added to the HTML that’s causing it to break once it arrives onto your site.

    Looking forward to your reply.

  • Unknown's avatar

    Thanks!

    I tried it again here.

    When I go into the post, it shows the classic editor and the edit as html looks like this:
    <p><a class="button" href="<a href="https://www.google.com">https://www.google.com</a>">Google It</a></p>

    As an alternate test, I typed into into notepad, saved as html, opened in Chrome and pasted into gmail and got this result. The edit as html looks like this:
    <a href="https://wikipedia.org/wiki/Echinopsis_subdenudata/">Echinopsis Subdenudata Care</a>

  • Unknown's avatar

    Thanks!

    This post including the button code was typed into gmail.

    The edit as html looks like this
    <a href="https://wikipedia.org/wiki/Echinopsis_subdenudata/">Echinopsis Subdenudata Care</a>

    An alternate test typed into notepad, saved as html, opened in Chrome and pasted into gmail gave this result.

    The edit as html looks like this
    <a href="https://wikipedia.org/wiki/Echinopsis_subdenudata/">Echinopsis Subdenudata Care</a></p>

  • Unknown's avatar

    Correcting an error in my post…

    The edit in html for the post typed into gmail (first example) looks like this
    <p><a class="button" href="<a href="https://www.google.com">https://www.google.com</a>">Google It</a></p>

  • Unknown's avatar

    Arggh, it is difficult posting code. What my comment doesn’t show is that wordpress is removing the beginning angle bracket next to class and placing it with the href and duplicating the link to create the link text .

    I tried pasting it here with some spaces

    How it looks in wordpress html editor:

    & l t ; a class=”button” href=”< a href = “https://www.google.com”
    > https://www.google.com < / a >” & g t ; Google I t & l t ; / a & g t ;

    How I typed it in gmail:

    < a class = “button” href = “https://www.google.com” > Google It < / a >

  • Unknown's avatar

    Thanks for that information – that helps a lot!

    When you’re making a new post in Gmail, are you changing the editor to the Plain Text editor? What makes me think that you’re not is that you’re entering < but it’s getting converted to & l t ; (without spaces) which is the HTML code for <.

    You can tell if you are using the plain text editor is by clicking the three dots in the post editor and making sure that’s checked: screenshot https://d.pr/i/kn709C

    If not, turn that on and try another post again and set the status as [status draft] and get back to us with a link to that post draft and we can take a closer look.

    Thanks!

  • Unknown's avatar

    Thanks. It looks like just class=”button” is being removed now.

    Here is the draft post.

  • @alistmgmt I’ll do some testing, but I’m just getting that the PBE tool just doesn’t know how to parse HTML or anything but the expected shortcodes here:
    https://wordpress.com/support/post-by-email/

    Your email can be plain text or formatted. As much formatting as possible will be retained, although the Post by Email system will strip unnecessary HTML tags so that your email is displayed correctly. Note that you will need to use an email client that supports rich text or HTML formatting in order to make use of this feature. Most email clients do support this. You may need to switch your client into rich text or formatted mode.

    I’m guessing that’s the issue here: the CSS class in this case isn’t getting stripped, it’s getting converted to display the HTML code itself.

    Have you had this work successfully before?

  • Unknown's avatar

    I have not tried it successfully. It was just a wild idea I had.

    If it’s not possible, I’ll explore custom shortcodes and plugins. I’m not very familiar with either of those but perhaps that may be a solution.

  • Thanks, @alistmgmt. I’m fairly sure it’s not possible for now because of the way that’s stripped.

    Just to understand more about your use case, will the last link in your post always be a button?

  • Unknown's avatar

    Yes, the last link in certain posts will always be a button. It’s a call to action/link. I can definitely just use a link for now.

    Thank you for trying. I appreciate all the help!

  • The topic ‘Post by email formatting’ is closed to new replies.