Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anni 4 posts 85 karma points
    Jan 18, 2018 @ 15:17
    Anni
    0

    Email formatting

    Hi all

    First of all thanks for a great package @MrMarsRed!

    My only question is that when I receive a formulate submission by email all the fields are rendered one after another without line breaks like this:

    A submission was sent through the contact form: First Name: test Surname: test Company Name: test Sector: test Email Address: test Phone: 0123456789 How can we help: test
    

    Is this by design or is there a way to add a line break after each field like so:

    A submission was sent through the contact form: 
    First Name: test 
    Surname: test 
    Company Name: test
    Sector: test 
    Email Address: test 
    Phone: 0123456789 
    How can we help: test
    

    I've only begun working with Umbraco some months ago so excuse me my ignorance if there is a simple solution to this. I'm not exactly a programmer either so if this can be done with a bit of code poking, please could you be as specific as possible. :)

    Many thanks,

    Anni

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jan 18, 2018 @ 16:17
    Nicholas Westby
    0

    Hi Anni,

    I don't believe I've seen that before. The fields should already be on their own lines. Which email client do you use? Perhaps that's rendering line breaks oddly.

    As you can see here: https://github.com/rhythmagency/formulate/blob/master/src/formulate.app/Forms/Handlers/Email/EmailHandler.cs#L450

    // Return message.
    return baseMessage + nl + string.Join(nl, lines);
    

    It's separating each field with a newline character (the nl variable was set to Environment.NewLine).

    That being said, we may be able to find a workaround once I know more about your email client.

  • Anni 4 posts 85 karma points
    Jan 18, 2018 @ 16:28
    Anni
    0

    Hi Nicholas

    Of course, I didn't think that the email client could be the suspect.

    I'm mainly using Outlook in the Office 365 environment. Unfortunately the desktop version of Outlook and the Windows 10 email application also render the email without line breaks.

    Much appreciated if you're able to find a workaround for this.

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jan 18, 2018 @ 16:34
    Nicholas Westby
    0

    Would you be able to send me a screenshot of one of the emails? If it contains sensitive information, you can send it to me via this contact form rather than the Umbraco forum: http://www.nicholaswestby.com/contact/

    I'm wondering if maybe your emails contain some HTML-looking characters and that is causing Outlook to interpret it as an HTML email rather than a plain text email. If so, line breaks in HTML are different than plain text, and so Outlook wouldn't think there are any line breaks. That's a bit of a long shot, but worth looking into.

  • Anni 4 posts 85 karma points
    Jan 18, 2018 @ 16:44
    Anni
    0

    Hi Nicholas

    Here is a screenshot:

    enter image description here

    Thank you for your efforts in this.

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Jan 18, 2018 @ 17:32
    Nicholas Westby
    100

    Looks like there are a few potential causes, which you can read through in the answers to this Stack Overflow question: https://stackoverflow.com/questions/6680779/line-breaks-ignored-when-sending-mail-as-plain-text

    Some reasons include:

    • The mail server is adding an HTML version of the plain text email.
    • Outlook is removing "extra" line breaks (a setting that can be disabled).

    For now, I recommend submitting an issue here: https://github.com/rhythmagency/formulate/issues

    My thought is that the easiest solution will be to add an HTML version of the email (rather than just plain text).

    If you or somebody you know can submit a pull request, the issue will be resolved more quickly.

  • Anni 4 posts 85 karma points
    Mar 05, 2018 @ 16:33
    Anni
    1

    Hi Nicholas

    I started looking into this again today -- turns out our SMTP server on SendGrid was using click tracking which indeed turns the plain text email into an HTML version. So you were correct about the problem lying within the mail server. So to anyone else running into this problem: make sure your mail server doesn't have a similar setting on.

    Thank you for the tip that helped us solve this!

Please Sign in or register to post replies

Write your reply to:

Draft