Posted by Tom
2014-06-24
So, you just need to put angle brackets around an email address? You can do it by replacing a line in web/codelib/slib/CEmail.inc.php. Open the file and and find the following code:
function CreateAddressLine( $ax )This is the 4th line from the bottom.
{
$s = "";
foreach ( $ax as $val )
{
if ( $s != '' ) $s .= ", ";
$addr = $val[0];
if ( isset( $val[1] ) )
{
$name = $val[1];
if ( $this->IsAscii($name) )
$s .= $name . " <" . $addr . ">";
else
$s .= $this->LineEncode( $name ) . " <" . $addr . ">";
}
else
$s .= $addr;
}
return $s;
}
$s .= $addr;Change it to:
$s .= "<" . $addr . ">";The result should look like:
function CreateAddressLine( $ax )Done!
{
$s = "";
foreach ( $ax as $val )
{
if ( $s != '' ) $s .= ", ";
$addr = $val[0];
if ( isset( $val[1] ) )
{
$name = $val[1];
if ( $this->IsAscii($name) )
$s .= $name . " <" . $addr . ">";
else
$s .= $this->LineEncode( $name ) . " <" . $addr . ">";
}
else
$s .= "<" . $addr . ">";
}
return $s;
}
→ Form2DB
If I enable angle brackets (which is the default setting for the server), emails are delivered normally by normal user, however the Form2DB form causes the server to generate a '501 Command MAIL expecting FROM:' error.
Can you guide me to right spot to fix this ? It's like it's not passing the brackets.
I don't know if it is just the From: line or others but From: is the first email address assignment in the file.