Send a mail with mail()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
broch
Forum Newbie
Posts: 4
Joined: Sat Sep 13, 2008 7:38 am

Send a mail with mail()

Post by broch »

Hi,
I want to send a mail with mail() and especially a EURO sign €

If I just send the message

$message = "€ Mail text";

it will turn up as a ?.
then I try to make a different header on the mail like this:

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/plain; charset=UTF-8\r\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\r\n";

and then encode the $message with
$message = mb_convert_encoding($message,"quoted-printable","ASCII");

When I then receive the mail I just get a blank space in where the € should have been even though it looks correct when I check the source of the mail: =80 Mail text

So could anybody help me and tell mere what I do wrong, or if there is another way to send a € in a plain text email.

Help is much appreciated.

Thanks,
broch
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Send a mail with mail()

Post by yacahuma »

I suggest using phpmailer
broch
Forum Newbie
Posts: 4
Joined: Sat Sep 13, 2008 7:38 am

Re: Send a mail with mail()

Post by broch »

Yes, but it could be nice to understand this. I can though send it with text/html and convert to html-entities. That works

broch
User avatar
budimir
Forum Newbie
Posts: 2
Joined: Sun Sep 14, 2008 3:31 pm

Re: Send a mail with mail()

Post by budimir »

I suggest you take a look at utf-8 table for special characters. You will see what you should put in so EUR sign whould show up. Or what ever encoding you are using.

Take a look at the links:

http://biega.com/special-char.html
http://goulvench.free.fr/vrac/UTF8codes.html

:wink:
Post Reply