How do I show the form for adding a node as block? I have a content type with the title and name fields. How can I the form for adding a node as block, in the front page? 

I am using Drupal 7.

function mail_block_info() {
  $blocks = array();
  $blocks['mail_block'] = array(
    'info' =&gt; t('backend info left block'),
    'cache' =&gt; DRUPAL_NO_CACHE,
  );

  return $blocks;
}


function mail_block_view($block_name = '') {
  if ($block_name == 'mail_block') {
    $match = TRUE;
    $types = array('mailin_list_node_form' =&gt; 1);
    if (arg(0) == 'node' &amp;&amp; is_numeric(arg(1))) {
      $node = node_load(array('nid' =&gt; $nid));
      $type = $node-&gt;type;
      if (isset($types[$type])) {
        $match = FALSE;
      }
    }

    $contact_node = node_load($node);

    drupal_get_form($node);
    $block = array(
      'subject' =&gt; t(''),
      'content' =&gt; $content,
    );

    return $block;
  }
}
Try node_add():

$content = node_add($type);


or:

$content = drupal_get_form($type . '_node_form', $node);


Also, please keep in mind that node_load() changed in D7. You should use it like this:

node_load($nid);