Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7958649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:27:16+00:00 2026-06-04T04:27:16+00:00

i have read the mail in php with imap_fetchbody() and decode it with imap_qprint().

  • 0

i have read the mail in php with imap_fetchbody() and decode it with imap_qprint().

$body = imap_fetchbody($mbox, $no, 1);
$body = imap_qprint($body);

but there is difference between original mail and output mail

Original mail:

Plain Text

This is a testing mail to check

first second third fourth fifth sixth Home

this is yellow background

website: http://bizved.com

testing of quote

Thank you Hiren Manek Bhuved Solutions

output mail

Plain Text

This is a testing mail to check

first second third fourth fifth sixth Home

this is yellow background

website:�http://bizved.com

testing of�quote

Thank you �Hiren Manek Bhuved Solutions

can anybody gives solution?
thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T04:27:17+00:00Added an answer on June 4, 2026 at 4:27 am

    I have make the following solution as mail headers already its character set.

    $st = imap_fetchstructure($mbox, $no); 
    $part = $st->parts[$partno];
    $body = imap_fetchbody($mbox, $no, $partno);
    $body = imap_qprint($body);
    $charset = 'UTF-8';
    if(!empty($part->parameters)){
        for ($k = 0, $l = count($part->parameters); $k < $l; $k++) {
            $attribute = $part->parameters[$k];
            if($attribute->attribute == 'CHARSET'){
                $charset = $attribute->value;
            }
        }
    }
    //echo $charset;
    $bodytext = mb_convert_encoding($body,'UTF-8',$charset);
    

    This not full solution. It’s only for character encoding. Mail has different parts for plain text, html text, attachments, etc. for that you should have different handling for each type.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have read many about REST api in php articles. but I still get
I have to read Gmail's imap mail with a Python script with Django, and
I have used the module Mail::Webmail::Gmail to read the new messages in my Gmail
I have read that you can do it, but would this really improve performance
I have read this question but it's not quite what I was looking for.
I have like 50 different php files which all use the mail function. After
I'm currently using PHP's mail() function to email the HTML Body of another PHP
I know the benefits of chaining within PHP but lets say we have this
I am sending email newsletters using php mail() function. I have to track the
I have a php mail script that works well except for one minor fact.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.