Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

mailing in php?

Posted on 1999-07-10
1
Medium Priority
?
185 Views
Last Modified: 2010-04-15
This is here since there is no php section.

I am using the mail function.  In the "message" section, I entered text, being very careful that it was formatted correctly.  However, once mailed, I end up with line breaks in the text in strange places, apparently random.  Sometimes there will be one word and then a line break in a sentance, sometimes 6 or 7 words and then a break.

Any idea what would might be causing this?

Thanks,

chris
0
Comment
Question by:ChrisAndrews
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
EatEmAndSmile earned 40 total points
ID: 1263486
This is caused because your breaks will be always respected, while another breaks will be added by the mail client according to it's line width tolerance.

 What you must do is to add a forced break '\n' only in the end of paragraphs. This will separate paragraphs and let the other lines to be handled by the mail client dinamically.

 An example would be:

<?php
$message="This is a sample message to show how to handle line breaks dinamically, without causing undesired line breaks.\nThis example was posted to the Experts Exchange website in answer to ChrisAndrews question.\nWe hope he can solve his problem with this example PHP3 code.\nWe also hope that the Experts Exchange staff make a PHP3 section available soon.\n\nSender IP Address: $REMOTE_ADDR\n\nRegards,\n\nEatEm And Smile.";

mail("webmaster@example.org", "Sample Message", $message);
?>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question