SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
Thread: email has no line breaks!
-
Aug 20, 2001, 02:04 #1
- Join Date
- Jul 2001
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
email has no line breaks!
Hello,
I have a problem with the emails sent with mail().
They all arrive to the users without linebreaks. I've tried \n but that doesn't work. What is the problem. Server setup?
Scott
-
Aug 20, 2001, 02:27 #2
- Join Date
- Feb 2001
- Location
- New Zealand
- Posts
- 516
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Not sure if this would be a problem, or if it would apply when sending emails, but is your message in double quotes or single quotes?
eg:
$message = "blah \n";
or
$message = 'blah \n';Oh no! the coots are eating my nodes!
-
Aug 20, 2001, 03:13 #3
- Join Date
- Jul 2001
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The text is pulled out of a db with a function but as far as I can tell the $message variable is surrounded in double quotes.
Scott
-
Aug 20, 2001, 03:18 #4
- Join Date
- Jul 2001
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Have you noticed that this forum also has no linebreaks in the emails sent from it?
Only the excerpt has linebreaks. Here is what I recieved:
Code:Hello scamo, timnz has just replied to a thread you have subscribed to entitled - email has no line breaks! - in the PHP and MySQL forum of SitePoint Community Forums. Excerpt: Not sure if this would be a problem, or if it would apply when sending emails, but is your message in double quotes or single quotes? eg: $message = "blah \n"; or $message = 'blah \n'; This thread is located at: http://sitepointforums.com/showthrea...4&goto=newpost There may be other replies also, but you will not receive any more notifications until you visit the board again. Yours, SitePoint Community Forums team ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Unsubscription information: To unsubscribe from this thread, please visit this page: http://sitepointforums.com/member2.p...threadid=31694 To unsubscribe from ALL threads, please visit this page: http://sitepointforums.com/member2.p...type=allthread
ScottLast edited by scamo; Aug 20, 2001 at 03:31.
-
Aug 20, 2001, 10:23 #5
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Trya \r\n where you want the line breaks.
Please don't PM me with questions.
Use the forums, that is what they are here for.
-
Aug 20, 2001, 11:04 #6
- Join Date
- Aug 1999
- Location
- Pittsburgh, PA, USA
- Posts
- 3,910
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Um, the emails from this forum have always worked perfectly for me...maybe something's wrong with your email client. They've always had line breaks for me.
-
Aug 20, 2001, 11:07 #7
- Join Date
- Nov 2000
- Location
- Hong Kong
- Posts
- 1,508
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You must do:
$text = str_replace("\n", "\r\n", $text);
-
Aug 20, 2001, 23:55 #8
- Join Date
- Feb 2001
- Location
- New Zealand
- Posts
- 516
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Do you really have to do that? Because the emails I have sent myself through one of my email scripts, worked perfectly when I had like:
$str = "Hello\nThis is on a newline";Oh no! the coots are eating my nodes!
-
Aug 21, 2001, 05:55 #9
- Join Date
- Jul 2001
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I think we have come closer to an answer. My colleague found out something. You can determine the content-type in the header of your email when using the mail() function. Something like this:
Code:$message = "The following email includes a formatted ASCII table\n"; $message .= "Day \t\tMonth \t\tYear\n"; $message .= "3rd \t\tAug \t\t1970\n"; $message .= "17rd\t\tAug \t\t1973\n"; $headers = "Content-Type: text/html; charset=iso-8859-1\n"; mail("$address","Teste mail() Funktion",$message,$headers);
We'll see if that'll do the trick!
Thanx everyone for your input.
Scott
Bookmarks