/    Sign up×
Community /Pin to ProfileBookmark

Email formatting

I’m trying to allow my users to enter a message to be sent in a email– it’s an invitation to join. How can I preserve the lines of the message being entered into an HTML textarea. If someone wanted to say “Hello,” and then hit Enter or Return twice to move the cursor down before beginning their message, how can those spaces be carried over. Is there a way to format the initial text in between the <textarea> and </textarea> tags?

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@amandergeAug 15.2007 — If the e-mail is being sent in HTML format, you can use the nl2br() function.

If the e-mail is not HTML but plain-text, the text that was entered in the form element will be shown in the same way, assuming that the text entered in the form did not crash your code. ?
Copy linkTweet thisAlerts:
@dz_boyauthorAug 15.2007 — How do you distinguish which method of email you'd like to use. Is that server-based?
Copy linkTweet thisAlerts:
@amandergeAug 15.2007 — It is somethign you specify in the 'headers' parameter of the mail() function.

Check out Example #4 from Zend. ?

How do you distinguish which method of email you'd like to use. Is that server-based?[/QUOTE]
Copy linkTweet thisAlerts:
@YelgnidrocAug 15.2007 — I tend to send mime e-mails as some clients cannot read html.
Copy linkTweet thisAlerts:
@amandergeAug 15.2007 — Then the newline character used in the text box should be usable in the mime e-mails - no changes required.

Let me know if it works.
×

Success!

Help @dz_boy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...