I have been working on a custom extension and I need a function to send the generated CSV file. Can you please let me know what might be the possible error in it.

protected function _sendCSV($filename, $subject, $last_update, $now) {
    $template_id = "svm_export_email";
    $email_template =  Mage::getModel('core/email_template')-&gt;loadDefault($template_id)-&gt;setSubject($subject." [".$now."]");
    $template_variables = array(
        'file_name' =&gt; $filename,
        'last_update' =&gt; $last_update,
        'now' =&gt;$now,
        );
    $email_template-&gt;getProcessedTemplate($template_variables);

    $sender = array('My Team' =&gt; Mage::getStoreConfig('trans_email/ident_general/email'));
    $email_template-&gt;setFrom($sender);


    $file = Mage::getBaseDir('var') . DS .'SVM'. DS .date('Y'). DS .date('m'). DS .$filename;
    $attachment = $email_template-&gt;getMail()-&gt;createAttachment(file_get_contents($file));
    $attachment-&gt;filename = $filename;

    try {
        $email_template-&gt;send('thecoderin@gmail.com','My Gmail');
    } catch (Exception $e) {
        Mage::log($e-&gt;getMessage(), NULL, self::LOG);
        return false;
    }
    Mage::log($filename." File sent through mail", NULL, self::LOG);
    return true;
}


I am getting the following error on invoking the function:

exception 'Exception' with message 'This letter cannot be sent.' in /my/magento/root/app/code/core/Mage/Core/Model/Email/Template.php:398


Thanks!


Question: Create an "All Posts" or "Archives" Page with WordPress 3.0?
Answer: I ended up creating a page template called "allposts-page.php" in the Twenty-Ten Themes folder containing the following code:

&lt;?php
/**
 * Template Name: All Posts
 *
 * A custom page template for displaying all posts.
 *
 * The "Template Name:" bit above allows this to be selectable
 * from a dropdown menu on the edit page screen.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */

get_header(); ?&gt;

  &lt;div id="container"&gt;
   &lt;div id="content" role="main"&gt;
&lt;h2&gt;Archive of All Posts:&lt;/h2&gt;
  &lt;ul&gt;
    &lt;?php wp_get_archives('type=postbypost'); ?&gt;
  &lt;/ul&gt;


   &lt;/div&gt;&lt;!-- #content --&gt;
  &lt;/div&gt;&lt;!-- #container --&gt;

&lt;?php get_footer(); ?&gt;


I then created a new page using the Wordpress Admin system with a title of "All Posts" and selected the "All Posts" template from the drop-down. Didn't need to enter anything in the body.

The resulting page can be found via:

www.oceanbytes.org/all-posts/

The default for "wp_get_archives" is "monthly" but I chose "postbypost" as I wanted to just list all posts as on long list.  More options can be found on the Wordpress site via Function Reference/wp get archives