Results 1 to 2 of 2

Thread: PHP Mail corrupts German charcaters or newlines

  1. #1
    Join Date
    Feb 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Mail corrupts German charcaters or newlines

    Hi,

    I have to send email containing German characters (e.g. umlauts). I already had a script which worked with English characters, but it would mess up the German ones.

    So, I decided to use encoding in the header, and encoded it to UTF-8 as text/html (using text/plain does not work). Now, the German characters appear OK, but the newlines get lost. I tried using \n and \r\n as newline characters, but it does not work.

    Here is the code fragment which I am using:

    $name = $_POST['sendername'];
    $telefon = $_POST['telefon'];
    $message = $_POST['message'];
    $email = $_POST['email'];
    $typedcode = $_POST['typedcode'];
    $body = "* Name:\n$name\n\n".
    "* Email:\n$email\n\n".
    "* Telefon:\n$telefon\n\n".
    "* Anfrage:\n$message";

    $result = 'ok';
    mail("myname@gmx.net", "Kontaktformular", $body, "From: $email\n" .
    "MIME-Version: 1.0\n" . "Content-type: text/html; charset=utf-8\n" );

    As I said above, I tried using \r\n too, but it does not work.

    Any answers or suggestions are most welcome.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Being that you are using text/html, try using <br> for the newlines.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •