2

I tried to send mail using phpmailer.It is working fine for the english content but now I want to send marathi content mail.The marathi content mail is not sending to the user.The mail is look like महारा. Please let me know what should I do. My Code is $mail = new PHPMailer(); $mail->CharSet = "UTF-8"; $mail->IsSMTP(); // we are going to use SMTP $mail->SMTPAuth = true; // enabled SMTP authentication //$mail->SMTPSecure = "ssl"; // prefix for secure protocol to connect to the server $mail->Host = ""; // setting GMail as our SMTP server $mail->Port = ""; // SMTP port to connect to GMail $mail->Username = ""; // user email address $mail->Password = ""; // password in GMail

        $mail->ContentType   = "text/html";            //set character set

        $mail->SetFrom('mail_user1', 'Nathe Publication');  //Who is sending the email
        $mail->AddReplyTo("mail_user1","Nathe Publication");  //email address that receives the response

        $mail->Subject    = "Email subject";

        $mail->Body  = '<html><head>';
        $mail->Body  .= '<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">';
        $mail->Body  .= '</head><body>';
        $mail->Body  .= '<p>';
        $mail->Body      .= "महाराष्ट्र";
        $mail->Body  .= '</p>';
        $mail->Body  .= '</body></html>';
        $mail->Body  = utf8_encode($mail->Body);
        $mail->Body  = utf8_decode($mail->Body);

        //$mail->AltBody    = "Plain text message";
        $destino = "mail_user2"; // Who is addressed the email to
        $mail->AddAddress($destino, "Ashik Lanjewar");

        //$mail->AddAttachment("images/phpmailer.gif");      // some attached files
        //$mail->AddAttachment("images/phpmailer_mini.gif"); // as many as you want
        if(!$mail->Send()) {
            $data["message"] = "Error: " . $mail->ErrorInfo;
        } else {
            $data["message"] = "Message sent correctly!";
            echo $mail->Body;
        }
        echo $data["message"];
        //$this->load->view('sent_mail',$data);
</code>

1 Answers1

-1

I ran into the same problem and I just have to restart XAMPP. Additionally, I wrapped all my strings into brackets. It is working for me. Strange but useful.