How do I make newline work in emails?

0 favourites
  • 13 posts
  • In my string, there is a newline after each I have the text showing on screen during the game, while words are placed. Also, I send this string to an e-mail. When it reaches, I figure out that between these words, there are only simple breaks ( spaces ) in the email. What do I add in the Set Value besides &newline in order to make line break work in usual exported texts?

  • <br> is the html tag for a line break, try replacing newline with that.

  • It gives a syntax error... I guess html tags are not welcomed in Value Set...

    This might be the only way?...

  • How are you sending the email? Are you sending the text via AJAX to a script in say PHP to send the email?

    For example you have: "Hello!" & newline & "Bye!" as your text.

    AJAX: post to url("tag", "", URLEncode(replace(text, newline, "<br>")), "POST")

    Then when the script receives the post, make sure to URLDecode.

  • I am sending e-mails with the help of this very nice plugin made by armaldio

    I have no idea how it sends, but it would be great to be able to add this real <br> to be received by normal e-mail platforms

  • Hello

    I'm not currently at home so I can't help now, but sure I will look at this is issue when go back at home.

    BTW, did you try to add <br> in the body of your mail. The body support html formatting

  • thanks for answering! the body of my mail consists only of the string that is created by Set Value box. and when I put <br> there they pop up with Syntax Error. It doesnt support it I guess

  • be sure that the br is part of the string

    "My name is... <br>Mister Madam!"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hello

    i just tried to send a mail containing <br> and it works

    If in your box you have a carriage return (line break) you can do this way :

    replace(yourText, "
    ", "<br>")
    and it should work 
    " is the caracets code of an html line break
  • MangoPolo

  • It really does! My God... I was just replacing &newline with &<br> that is why I was getting syntax erros....

    Thank you for answering armaldio! I still have a lot of work to do here....

    What would you recommend in order to achieve this thing in c2?

    can be made as a plugin or it should be integrated other way to be able to use as layout?

  • MangoPolo

    I just had a quick look so i can be wrong ^^

    As mentionned on Github

    [quote:1olay6pt]Include the JS and CSS, make a <div> for it to live in, and instantiate it:

    So i can make a plugin easily i think but you need also the div plugin from pode

    I will MP you when i look it more precisely

  • I replied via email. It looks amazing!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)