goldfish 1.0 & UTF8 FROM: Header

24 views
Skip to first unread message

René

unread,
Jul 8, 2009, 2:31:54 PM7/8/09
to goldfish-user
hi,

First of all. Thanks for your Script. Very useful :) But something
wont work if the From: - Header is UTF-encoded. Like this:

From: =?UTF-8?B?
UmVuw6kgRnJldW5kIC0gVW50ZXJuZWhtZW5zZ3J1cHBlIGFkb2NvbQ==?=
<em...@domain.de>

Theres a linebreak between "sendername" and email and your Script
won`t found the sender-email-address with your code:

foreach ($mail as $line)
{
$line = trim($line);
if (substr($line, 0, 5) ==
'From:')
{
$address = substr($line, strpos($line, '<') + 1, strpos($line, '>') -
strpos($line, '<')-1)."\n";
break;
}
}

This From: Line was produced with Thunderbird 2.0.22, German with
special chars @ sendername. Sending and Recieving MTA is Postfix.

I try to fix it by myself, but i think u should know :)

Regards,

René Freund

René

unread,
Jul 8, 2009, 3:07:12 PM7/8/09
to goldfish-user
Solved the Problem.

if the From-Line get no "@" char i simply use the returnpath. :) if i
got no returnpath theres no respond. Basta :D

Like this:

foreach ($mail as $line)
{
$line = trim($line);

if (substr($line, 0, 12) == 'Return-Path:')
{
$returnpath = substr($line, strpos($line, '<') + 1, strpos($line,
'>') - strpos($line, '<')-1)."\n";
}

if (substr($line, 0, 5) == 'From:' && strstr($line,"@"))
{
$address = substr($line, strpos($line, '<') + 1, strpos($line, '>')
- strpos($line, '<')-1)."\n";
break;
}
elseif(substr($line,0,5) == 'From:' && !strstr($line,"@") && !empty
($returnpath))
{
$address = $returnpath;
break;

remofritzsche

unread,
Jul 9, 2009, 5:52:39 AM7/9/09
to goldfish-user
Hey René

This sounds reasonable! Since I don't have a running system at the
moment, can anyone test the change to the script? If this is
successfull, I'll include your source in the new release!

Thanks a lot,
Remo

René

unread,
Jul 9, 2009, 7:16:15 AM7/9/09
to goldfish-user
Hi,

i use it and it works :)

René


und auf Deutsch:
Es funktioniert definitiv :) Ich weiss nicht ob der Returnpath bei
jedem MTA am Anfang der Header steht und somit auch bei einem
doppelzeiligem From verfügbar ist. Postfix installiert den dort
automatisch, selbst wenn kein eigener vom Client angegeben wurde.
Deshalb ist diese Lösung für Postfix auf jeden Fall geeignet.

René

remofritzsche

unread,
Jul 9, 2009, 8:57:58 AM7/9/09
to goldfish-user
Thank you!:) I have just released goldfish V 1.1, it can be downloaded
as usual under http://www.remofritzsche.com/goldfish/download/.

Remo

René

unread,
Jul 10, 2009, 8:56:03 AM7/10/09
to goldfish-user
Hi,

maybe the Returnpath should also be checked if there is an "@" inside

if (substr($line, 0, 12) == 'Return-Path:' && strstr
($line,"@"))

Greetz

René


Reply all
Reply to author
Forward
0 new messages