zbateson / mail-mime-parser

An email parser written in PHP
https://mail-mime-parser.org/
BSD 2-Clause "Simplified" License
458 stars 58 forks source link

to addresses are splittet in too much strings #172

Closed sirkokoenig closed 3 years ago

sirkokoenig commented 3 years ago

When I have a TO-header like this one: To: "max.muster@online.de" <max.muster@online.de> the output of foreach ($to->getAddresses() as $address) { echo "Empfänger: ".$address->getName() . " " . $address->getEmail()."
"; } is like Empfänger: " Empfänger: max.muster@online.de" Empfänger: < Empfänger: max.muster@online.de>

Somebody know the reason? I don´t know if it is also a problem with direct eml file analyses, but I copy and paste sometimes my headers and when I put these lines in an eml file this bug happenes.

zbateson commented 3 years ago

Hi @sirkokoenig --

Based on what I'm seeing on github (assuming no characters have been removed), it's an invalid header.

Correct forms: "max.muster@online.de" <max.muster@online.de> (name/email), or "max.muster@online.de", max.muster@online.de (2 addresses)

I'm assuming that's why it's giving you strange results. Otherwise a more complete example would be needed (example 'eml' file with this happening).

sirkokoenig commented 3 years ago

Hi, got it work. Was an conversion mistake in my code. Sometimes I need some other input to get another view on the things ;) Thanks!