title: Magento - how to get email address via order/customer_id
body: <p>How do I get the customer email address in Magento? Eventually I wish to export all shipment details in CSV format.</p>
  
  <pre><code>&lt;?php
      //External script - Load magento framework
      require_once("app/Mage.php");
      Mage::app('default');
  
      $myOrder=Mage::getModel('sales/order'); 
      $orders=Mage::getModel('sales/mysql4_order_collection');
      $allIds=$orders-&gt;getAllIds();
      foreach($allIds as $thisId) {
          $myOrder-&gt;load($thisId);
          echo "name: ". $myOrder-&gt;getShippingAddress()-&gt;getFirstname() . " " . $myOrder-&gt;getShippingAddress()-&gt;getLastname();
          echo "email: " . $myOrder-&gt;getPayment()-&gt;getOrder()-&gt;getEmail();
      }
      ?&gt;
  </code></pre>