Formatting Received POP Emails

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sodiumba
    New Member
    • Oct 2007
    • 2

    #1

    Formatting Received POP Emails

    Hi There
    I have been searching high and low on the internet for a solution to my problem but so far have failed to find one. I am trying to embed a pop3 mail reader into the administrative interface of my website so any admin user that has logged in can read their emails.

    So far I have managed to get it to connect, read and list the messages on the server but when it actually comes down to displaying the message i get the following output as a message body...

    Code:
    From: "Derry O'Neill" <user@example.com> 
    Subject: Welcome To Everything X-Box! 
    
    This is a multi-part message in MIME format.
    
    ------=_NextPart_000_0004_01C81BD3.F09EFDA0
    Content-Type: text/plain;
    charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    
    Hey There!
    As I understrand it you have been recruited to the everything x-box team =
    by our very own EXB DJ Danny. I have set you up with an EXB email =
    address and will be adding you to our staff database as soon as I can. =
    You can view the current progress of the EXB website development project =
    at http://www.example.com=20
    
    Eventually you will be required to add input to the site via the =
    administrative interface. This is a simple enough task but you will =
    require an administrative login to do so. Your admin login will be sent =
    to you via email as soon as it becomes available. Please be aware that =
    there may be a delay as I haven't quite got around to creating the admin =
    area as yet!
    
    May I be the first to welcome you onto the team and I hope you stay with =
    us throughout our web-based lifetime.
    
    Regards,
    Derry O'Neill
    ------=_NextPart_000_0004_01C81BD3.F09EFDA0
    Content-Type: text/html;
    charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable
    
    
    
    charset=3Diso-8859-1">
    it then goes on to display the html version of the email.

    Is there any way to do away with the additional headers and all the '=' signs to just leave the message text? if you need a real example of the out put check the site at;



    It will auto log in with an example email address

    Thanks In Advance,
    SodiumBA
    Last edited by Atli; Oct 31 '07, 08:04 PM. Reason: Removed emails and links.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi Sodium. Welcome to TSDN!

    I've removed your email address from your post, as posting emails in the technical forums is not allowed. This is mainly to protect your email from being harvested by spammers.

    I've also removed the links to the website in your example email, as links to almost anything expect test servers, especially webs that contain advertisements or other content that may violate the Posting Guidelines , are forbidden in the technical forums.

    As to your problem.
    You need to strip away those parts of the message you do not want to show. Emails like those you posted above are always formatted to some standard, so they shouldn't be very hard to parse into whatever you need.

    Check out the String Function section at php.net for a list of functions that can be used for this.

    If you run into any trouble, post again and we'll do our best to help you out.

    Comment

    • sodiumba
      New Member
      • Oct 2007
      • 2

      #3
      Thank you for you quick reply.

      First of all apologies for posting those links, it was just a cut and paste jobby and I was unaware that they were quoted.

      I have browsed through the different functions but am yet to find anything that will actually work. It must be possible otherwise squirrelmail and horde would be full of unsightly headers. I am at a loss and i'm thinking about maybe just implementing one of the above mentioned mail clients to save the headache hehe...

      although it would be better if i could get this to work so my mail client fits in with the site skin flawlessly.... :)

      Comment

      Working...