Jump to content

PHP Mail either corrupts umlaut characters or newlines


POPDUM

Recommended Posts

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.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.