Jump to content

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 = "xx@xx.hr";
$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: xx@xx.hr")){
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 = "budimir.skrtic@drezga.hr";
$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: servis@drezga.hr",$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???  >:(

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.