Jump to content

[SOLVED] Different encoding with mail()


budimir

Recommended Posts

Hey guys,

 

Does anyone know how to change encoding when sending email with mail(). I'm from Croatia and we have some special characters. My pages display everything OK, but when I send an email with these special chaaracters I get some strange things.

 

This is my code:

<?php
// Podaci za email poruku
$to = "[email protected]";
$subject = "Obavijest o reklamaciji br. XXX";
$poruka = "Ovo je obavijest o zaprimljenoj, obrađenoj i odobrenoj reklamaciji broj XXXX. Dijelovi će biti danas poslani i možete ih očekivati kroz nekoliko dana";

// Postavke email protokola
      ini_set('SMTP', 'server');
      ini_set('smtp_port', 25);

// Slanje emaila
if(mail($to,$subject,$poruka,"FROM: [email protected]")){
echo "Poruka je uspješno poslana na @xx.hr!";
} else {
echo "Poruka nije poslana!";
}
?>

 

The result I'm getting is something you can see on the screen!!

 

Does anyone know why is this happening and how to change it???

 

I really don't know what to do ... I tried everything I new ...

Link to comment
https://forums.phpfreaks.com/topic/122676-solved-different-encoding-with-mail/
Share on other sites

Still not working, I tried that before. It's like it's ignoring the encoding.

 

<?php
// Podaci za email poruku
$to = "[email protected]";
$subject = "Obavijest o reklamaciji br. XXX";
$headers .= "Content-type: text/plain; charset=utf-8\r\n";
$poruka = "Ovo je obavijest o zaprimljenoj, obrađenoj i odobrenoj reklamaciji broj XXXX. Dijelovi će biti danas poslani i možete ih očekivati kroz nekoliko dana";

// Postavke email protokola
      ini_set('SMTP', 'server');
      ini_set('smtp_port', 25);

// Slanje emaila
if(mail($to,$subject,$poruka,"FROM: [email protected]",$headers)){
echo "Poruka je uspješno poslana na @drezga.hr!";
} else {
echo "Poruka nije poslana!";
}
?>

 

Any more ideas??? It's killing me.

 

I don't understand what's wrong. I have tried diferrent encoding types and nothing worked...  ???

OK,

 

So here is the problem:

 

When I try to echo the message which I'm trying to send in the email, it looks OK.

 

When I send the email, the message is all messed up.

 

The encoding I'm using is UTF-8 and it works perfectly, but it does not apply to the email message.

 

Any ideas???  >:(

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.