Author Topic: PHP Library for parsing mime messages  (Read 6898 times)

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14333
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
PHP Library for parsing mime messages
« on: August 11, 2017, 12:46:28 PM »
So I'm building a system that will send dynamic emails with the details of the request/order embedded in the generated address so they can respond to it and the response will go back into the system.  I setup the subdomain and have a basic catch method and I have no problem with decoding the email to figure out where to stick it in the database, but I need a way to parse the mime message to actually extract the html message and the actual address it was sent to.  Have any of you worked with a good library so I don't have to build those functions from scratch? 


I am reading the message from stdin to a variable.  Most of the stuff I'm finding is built around extracting the details from an actual inbox, which I don't have.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14333
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: PHP Library for parsing mime messages
« Reply #1 on: August 11, 2017, 12:52:59 PM »
Well shit.  I spent a half hour looking last night and a little bit today.  Then I post here.  Then I look for 2 more minutes and find this: https://github.com/php-mime-mail-parser/php-mime-mail-parser  That will probably do exactly what I need.

KnuckleBuckett

  • Jackass In Charge
  • Posts: 8674
  • Karma: +26/-259
  • [url=http://google.com]I search a lot[/url]
Re: PHP Library for parsing mime messages
« Reply #2 on: August 12, 2017, 06:16:29 AM »
Shit man.  Two minutes. 

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14333
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: PHP Library for parsing mime messages
« Reply #3 on: August 12, 2017, 09:25:30 AM »
2 minutes!!

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14333
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: PHP Library for parsing mime messages
« Reply #4 on: August 17, 2017, 08:28:16 AM »
So... just in case anyone else needs to do this, fuck that library I mentioned.  I spent hours trying to get my local setup with dependencies and all this bullshit and then getting it to work with composer.  All because it needed some other library to function.  I got so pissed off that I started looking for alternatives last night on packagelist and found this: https://packagist.org/packages/zbateson/mail-mime-parser  I grabbed it with composer, started playing with it, and had a fully functioning setup in probably 30 minutes last night.  SO yeah.  Annoying AF.