Invalid address: return even on successfully sent e-mail Need help ASAP.
My function is sending e-mail on successful quit. E-mail is sent well. The problem is that i'm always getting "Invalid address:" before my normal exit message.
Code is following:

$message_text = array(
'id' =&gt; 'modulename' . '_' . 'key',
'to' =&gt; '2@example.com',
'subject' =&gt; "OK",
'body' =&gt; array("OK"),
'headers' =&gt; array(
    'From' =&gt; '1@example.com',
    'Sender' =&gt; '1@example.com',
    'Return-Path' =&gt; '1@example.com',
          ),
);
$system = drupal_mail_system($module, $key);
$message = $system-&gt;format($message_text);
$system-&gt;mail($message);


Thanks.
This is because of the absence of $message_text['from'];
In SMTP module smtp.module.inc line 74-85 there is hack that handles the absence of 'Reply-To' by setting it to $message['from'] which is also absent, consequently 'Reply-To' will be empty hence throwing the error Invalid address:.
add $message_text['from'] = 'your from address' this will solve the issue.