Fix for @UNKNOWN appearing after saving draft with local
addresses (Was some newbie questions)
Duncan Brannen
dbb@st-andrews.ac.uk
Tue, 08 May 2001 10:50:00 +0100
Hi All,
First thanks to Mathieu Legare for giving me the first fix below,
but I found this still left the @UNKNOWN in other places, so knowing what I
was now looking for I tried to 'fix' the other scripts. I'm not sure why
UNKNOWN$ works in
message.php3 but I have to use @UNKNOWN in the other scripts?
Not knowing much about IMP or PHP is there an easy way to stick the
@st-andrews.ac.uk
into an include file as a variable (loacal_domain) and replace it with the
variable(local_domain) in the changes below
to make this a configurable attribute?
Cheers,
Dunk
In message.php3 around line 64
----------------------------------------------------------------------------------------------
$addr = snip(imap_rfc822_write_address($ob->mailbox, $ob->host,
$ob->personal));
$addr =
ereg_replace("@UNKNOWN$","@st-andrews.ac.uk",$addr); #Added this line (64)
$inner = snip(imap_rfc822_write_address($ob->mailbox, $ob->host, ''));
In mailbox.php3 aound line 422
----------------------------------------
if (isset($h->toaddress)) {
$to = chop(decode_mime_string($h->toaddress));
$to = eregi_replace("@UNKNOWN","@st-andrews.ac.uk",$to); #Added this at
line 422
}
In compose.php3 around line 294
----------------------------------------------------------------------------
case DRAFT:
if ($mailbox && $index && $bodypart) {
$h = imap_header($imp->stream,
imap_msgno($imp->stream, $index));
if ($h) {
if (isset($h->fromaddress)) $from =
chop(decode_mime_string($h->fromaddress));
if (isset($h->toaddress)) { $to =
chop(decode_mime_string($h->toaddress)); #Add {
$to =
eregi_replace("@UNKNOWN","@st-andrews.ac.uk",$to);} #Add this line
if (isset($h->ccaddress)) {$cc =
chop(decode_mime_string($h->ccaddress)); #Add {
$cc =
ereg_replace("@UNKNOWN","@st-andrews.ac.uk",$cc);} #Add this line
if (isset($h->bccaddress)){ $bcc =
chop(decode_mime_string($h->bccaddress)); #Add {
$bcc =
ereg_replace("@UNKNOWN","@st-andrews.ac.uk",$bcc);} #Add this line
if (isset($h->reply_toaddress)) $reply_to
= chop(decode_mime_string($h->reply_toaddress)); #Suppose if users can
change the reply to
if (isset($h->subject)) $subject =
chop(decode_mime_string($h->subject)); #this might nee done as well
}