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 8313393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:28:38+00:00 2026-06-08T20:28:38+00:00

I having problems when I am trying to parse emails through PHP imap functions

  • 0

I having problems when I am trying to parse emails through PHP imap functions. I want to extract the text of the body but without HTML links (like mailto:xxxx) or issues with the encode. I think that I have tried (almost, I guess) everything. But with the only code that I am approaching to the desired end result is with the next:

$bodyText = imap_fetchbody($inbox,$email_number,1.2);

if(!strlen($bodyText)>0)
{
   $bodyText = imap_fetchbody($inbox,$email_number,1);
}

var_dump($bodyText);

The point is that with this I am getting issues with the final encoding (i think that this is the problem). So the var_dump output is something like:

> From: SomeOne <someone=40domain.com>
> To: Someone Else <someoneelse=40domain.com>
> =Date: lunes 23 de julio de 2012 13:04:43
> Subject: =46wd: =46W: URGE=21=21=21=21 Ley de Reforma del Congreso de 20=11
> =20
> Some text here, blah, blah, blah
> =20
> ---------- =46orwarded message ----------
> From: Whatever <whatever=40domain.com (mailto:whatever=40domain.com)>
> Date: 23 de julio de 2012 12:53
> Subject: =46wd: =46W: URGE=21=21=21=21 Ley de Reforma del Congreso de 20=11
> To: Someone <someone=40domain.com (mailto:someone=40domain=.com)>
> =20
> =20
> Some stuff=21=21
> =20
> ---------- =46orwarded message ----------
> =46rom: samuel l jackson <sanvuco=40domain.com (mailto:sanvuco=40domain.com)>
> Date: 2012/7/23
> Subject: =46W: URGE=21=21=21=21 Ley de Reforma del Congreso de 2011
> To: =22...Scary Monster=C2=B7=C2=B7=C2=B7 =C3=B2=5F=5F=C3=B3=22 <eowyn2=
6=40domain.com (mailto:eowyn26=40domain.com

I mean, there are appearing bad =40 instead of @ and the mailto:xxxx@domain.com blocks

Thanks you

  • 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-08T20:28:40+00:00Added an answer on June 8, 2026 at 8:28 pm

    Run the body string through

    quoted_printable_decode($bodyText);
    

    and you will get the printable, unencoded string you’re looking for. You can then continue with some regexp stuff to get rid of the mailtos and do any other parsing you like. An appropriate function for these tasks would be:

    preg_replace();
    

    http://www.php.net/manual/en/function.preg-replace.php

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

Sidebar

Related Questions

I'm trying to parse some HTML with DOM in PHP, but I'm having some
I'm trying to parse a URL, but I'm having problems: http://www.meteor.gov.tr/deniz/deniz-suyu-sicakligi.aspx When I call
I am trying to use HtmlAgilityPack to parse HTML, but am having problems. Sample
i'm trying to parse some json in perl, but am having problems with it.
I'm trying to parse a xml file and I'm having problems with a really
I'm trying to parse a well formed xhtml document. I'm having problems during the
I'm having problems with the following: http://jsfiddle.net/x55LD/1/ I'm trying to parse custom tags using
I'm trying to parse some XML using simpleXML in PHP. The problem I'm having
I'm trying to parse incoming e-mails and want to store the body as a
I'm having a problem parsing a JSON file in AS3. Im trying to parse

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.