Posted by Michael
2014-06-24

I've tested. With our mail server (Surgemail) if I disable the need for angle brackets emails are sent normally however they are only deliverable locally with our mail server's clients. Any attempt to deliver outside generates an error. 550 5.7.1. Actually when disabled I cannot even sent mail from my desktop.
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.
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 )
{
$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;
}
This is the 4th line from the bottom.
$s .= $addr;
Change it to:
$s .= "<" . $addr . ">";
The result should look like:
function CreateAddressLine( $ax )
{
$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;
}
Done!