I've got a website, as well as in the "Contact" section I've got a form which customers may complete to make contact with me. The shape is a straightforward form which action is really a php page.

The php code:

 $to = "email@domain.com";

 $name=$_POST['name']; // sender name
 $email=$_POST['email']; // sender email
 $tel= $_POST['tel']; // sender tel
 $subject=$_POST['subject']; // subject CHOSEN FROM DROPLIST, ALL TESTED
 $text=$_POST['text']; // Message from sender
 $text.="\n\nTel:".$tel; // Added to message to show me the telephone nr to the sender at bottom of message

 $headers="MIME-Version: 1.0"."\n";
 $headers.="Content-type: text/plain; charset=UTF-8"."\n";
 $headers.="From: $name <$email>"."\n";

 mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $text, $headers, '-fno-reply@domain.com');

Could somebody please let me know why this works more often than not, but sometimes I receive email whith no text and also the subject line showing

=?UTF-8?B??=

I personally use outlook express, and that i read this http://stackoverflow.com/questions/454833/system-net-mail-and-utf-8bxxxxx-headers however it did not help.

The issue is not in Outlook, because after i log to the actual mailprogram where I fetch the POP3 emails from, the e-mail looks exactly the same.

After I right click in Outlook and chose "message source" then there's no "From" information.

Ex, a great message need to look such as this:

Subject: =?UTF-8?B?w5Z2cmlndA==?=

MIME-Version: 1.

Content-type: text/plain charset=UTF-8

From: Someone In Particular 

However, those with problem appears like this:

Subject: =?UTF-8?B??=

MIME-Version: 1.

Content-type: text/plain charset=UTF-8

From:  

As though the data is lost somewhere.

You need to know additionally that I've got a VPS, that we manage myself. I personally use postfix being an emailserver, if thats got anything related to it. However again, why do you use it sometimes?

Also another factor which i have observed is the fact that sometimes special figures aren't proven properly (by both Outlook and also the webmail).

For example, the title "Björkman" in swedish is proven like Björkman, however, only sometimes.

I really hope anybody knows something relating to this problem, since it is very difficult to find for me personally atleast.

If you want more input tell me.

Appears like the shape is published with all of fields left blank. You will find bots moving the internet and posting empty forms. Are you currently in a position to reproduce this with actual form data?

Additional hint: your code is available to email header injection - I'm able to publish any headers I would like, separated by line breaks, in $_Publish['name'] as well as your code will place it in to the email headers. A minimum of remove any line breaks from user data which will enter in the header section.