How do I make newline work in emails?

Just started using Construct 2? Post your questions here

Post » Thu Apr 16, 2015 12:39 am

In my string, there is a newline after each object.name. 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?
B
8
S
2
Posts: 110
Reputation: 923

Post » Tue Apr 21, 2015 4:21 pm

<br> is the html tag for a line break, try replacing newline with that.
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,388

Post » Tue Apr 21, 2015 9:36 pm

It gives a syntax error... I guess html tags are not welcomed in Value Set...
This might be the only way?...
B
8
S
2
Posts: 110
Reputation: 923

Post » Thu Apr 23, 2015 3:50 pm

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", "https://mydomain.com/emailpage.php", URLEncode(replace(text, newline, "<br>")), "POST")

Then when the script receives the post, make sure to URLDecode.
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,388

Post » Thu Apr 23, 2015 4:34 pm

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

scirra.com/tutorials/1052/send-an-e-mail-using-construct-and-mandrill-plugin

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
B
8
S
2
Posts: 110
Reputation: 923

Post » Fri Apr 24, 2015 6:10 pm

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 ;)
http://armaldio.xyz - Image - Join now our Discord Server ;) - https://discord.gg/0eLPLj96B4tUr1D3

If you like my work you can donate some bucks ;)

Image
B
53
S
16
G
1
Posts: 245
Reputation: 5,558

Post » Fri Apr 24, 2015 10:11 pm

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
B
8
S
2
Posts: 110
Reputation: 923

Post » Sat Apr 25, 2015 10:03 am

be sure that the br is part of the string
"My name is... <br>Mister Madam!"
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
43
S
18
G
18
Posts: 2,106
Reputation: 16,436

Post » Sun Apr 26, 2015 6:07 pm

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 :

Code: Select all
replace(yourText, "&#13;", "<br>")


and it should work ;)

"&#13;" is the caracets code of an html line break
http://armaldio.xyz - Image - Join now our Discord Server ;) - https://discord.gg/0eLPLj96B4tUr1D3

If you like my work you can donate some bucks ;)

Image
B
53
S
16
G
1
Posts: 245
Reputation: 5,558

Post » Sun Apr 26, 2015 6:12 pm

@MangoPolo
http://armaldio.xyz - Image - Join now our Discord Server ;) - https://discord.gg/0eLPLj96B4tUr1D3

If you like my work you can donate some bucks ;)

Image
B
53
S
16
G
1
Posts: 245
Reputation: 5,558

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: OddConfection and 1 guest