Author Topic: fatal: usage: sendmail [options] on Send  (Read 9705 times)

Offline mkaatman

  • Newbie
  • *
  • Posts: 8
fatal: usage: sendmail [options] on Send
« on: September 20, 2006, 11:05:27 AM »
Hello all,

Has anyone seen this error before?

Sep 20 10:02:13 localhost postfix/sendmail[6424]: fatal: usage: sendmail [options]

It just started happening yesterday. Every time I try to send mail I get the roundcube mail warning "Failed to send message" and the above entry in my log file.

I tried squirrelmail to see if it was a system problem but squirrelmail can send fine. I've tried restarting services and even rebooting the box the error persists.

Offline mkaatman

  • Newbie
  • *
  • Posts: 8
Re: fatal: usage: sendmail [options] on Send
« Reply #1 on: September 21, 2006, 03:50:48 PM »
A quick update. I've been troubleshooting this problem quite a bit and I've been in the roundcube irc channel bouncing ideas off those guys.

I realized roundcube is resetting the php error log to it's own based on the config so I have an error now:
[21-Sep-2006 14:19:32 -0500] SMTP Error: SMTP error: No From address has been provided
 in /var/www/round/trunk/roundcubemail/program/steps/mail/sendmail.inc on line 323

On line 316 of sendmail.inc
  $sent = smtp_mail($from, $a_recipients, $header_str, $msg_body);

I confirmed that $from was empty and if I manually hardcoded an email address I could successfully send email.

I'm using SVN revision 348.

Now that I've regained some sanity I'm trying to figure out why $from isn't being set properly.

I believe my problem is in this block of code:
Code: [Select]
$identity_arr = rcmail_get_identity(get_input_value('_from', RCUBE_INPUT_POST));

$from = $identity_arr['mailto'];
$first_to = is_array($to_address_arr[0]) ? $to_address_arr[0]['mailto'] : $mailto;

if (empty($identity_arr['string']))
 $identity_arr['string'] = $from;

// compose headers array
$headers = array('Date' => date('D, j M Y G:i:s O'),
         'From' => $identity_arr['string'],
         'To'  => rcube_charset_convert($mailto, $input_charset, $message_cha$


Most likely something to do with the rcmail_get_identity function not setting mailto properly.
Code: [Select]
function rcmail_get_identity($id)
 {
 global $DB, $CHARSET, $OUTPUT;

 // get identity record
 $sql_result = $DB->query("SELECT *, email AS mailto
              FROM ".get_table_name('identities')."
              WHERE identity_id=?
              AND  user_id=?
              AND  del<>1",
              $id,$_SESSION['user_id']);

 if ($DB->num_rows($sql_result))
  {
  $sql_arr = $DB->fetch_assoc($sql_result);
  $out = $sql_arr;
  $name = strpos($sql_arr['name'], ",") ? '"'.$sql_arr['name'].'"' : $sql_arr['name'$
  $out['string'] = sprintf('%s <%s>',
               rcube_charset_convert($name, $CHARSET, $OUTPUT->get_chars$
               $sql_arr['mailto']);

  return $out;
  }

 return FALSE;
 }

($DB->num_rows($sql_result)) is equaling 0

In this query:
 // get identity record
 $sql_result = $DB->query("SELECT *, email AS mailto
              FROM ".get_table_name('identities')."
              WHERE identity_id=?
              AND  user_id=?
              AND  del<>1",
              $id,$_SESSION['user_id']);

get_table_name('identities') is identities which is valid
$id is empty
$_SESSION['user_id'] is 7 which is valid

If I go back to the compose screen and enter my email address in the Sender field, $id is set to that email address.

ha! here's the kicker, if I go back to the compose screen and enter '7' as my Sender the mail is sent!

So from what I can tell that SQL needs to be rewritten to look at the identities.email instead of indentities.identity_id.

How am I the only one with this problem?

Offline mkaatman

  • Newbie
  • *
  • Posts: 8
Re: fatal: usage: sendmail [options] on Send
« Reply #2 on: September 21, 2006, 03:58:41 PM »
Taking it one step further...

It seems the proper behavior for the compose screen is to have a drop down combo box for sender, whereas I have a text field. That would explain why I'm having the problem, but why am I getting a text field instead of the drop down?

Here's what mine looks like:
Code: [Select]
<td class=&quot;title&quot;><label for=&quot;rcmcomposefrom&quot;>Sender</label></td>
<td><input name=&quot;_from&quot; id=&quot;rcmcomposefrom&quot; tabindex=&quot;1&quot; type=&quot;text&quot; /></td>

Here's what the demo looks like:
Code: [Select]



Now I'll dig through the source to find out when it prints a text field instead of the select.

Offline mkaatman

  • Newbie
  • *
  • Posts: 8
Re: fatal: usage: sendmail [options] on Send
« Reply #3 on: September 24, 2006, 12:55:38 AM »
Found the problem.

Somehow I was missing identities.html_entities.

I ran:
ALTER TABLE identities ADD `html_signature` tinyint( 1 ) NOT NULL default '0'

problem solved.

I'll close:
http://trac.roundcube.net/trac.cgi/ticket/1484038