I'm using the simplenews module for sending newsletters. When I send a test mail I get a perfectly filled template in my e-mailbox.
But when I send the mail for real to all my contacts. I and they only receive the mark-up from the template(images and etc.) and no content from the fields.

I use print $node->field_nb_content[0]['view'] to write/print all my fields in the template.

Any one, with an idea?

Comments

franz’s picture

Can you post the full code you used?

Did you load the node before sending?

Does it work without simplenews template (only simplenews)?

Maurice0082’s picture

This is the code of the simplenews-newsletter-body-5.tpl.php (the 5 according to the id of the newsletter)

<?php
// $Id: simplenews-newsletter-body.tpl.php,v 1.1.2.4 2009/01/02 11:59:33 sutharsan Exp $

/**
 * @file
 * Default theme implementation to format the simplenews newsletter body.
 *
 * Copy this file in your theme directory to create a custom themed body.
 * Rename it to simplenews-newsletter-body--<tid>.tpl.php to override it for a 
 * newsletter using the newsletter term's id.
 *
 * Available variables:
 * - node: Newsletter node object
 * - $body: Newsletter body (formatted as plain text or HTML)
 * - $title: Node title
 * - $language: Language object
 *
 * @see template_preprocess_simplenews_newsletter_body()
 */
?>

<style type="text/css">

.style{margin:0px; paddding:0px;}
td{vertical-align:top !important;}
table .table-clear{margin:0px!important;}3
table .footer{font-size:0.6em!important; color:#000 !important;}
table {margin:0px!important; paddding:0px!important;}
table {color:#ffffff;}
</style>

<?php echo $style_element; ?>

<body style="padding:0; margin:0; background-color:#262626;">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top" style="background-color:#eeeeee;"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="50px" style="background-color:#989898;">&nbsp;</td>
      </tr>
    </table></td>
    <td width="550px" valign="top" style="background-color:#d19800;">
    
    <!-- begin tabel top / foto -->
    <table width="550px" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td background="http://www.stichtingdepijler.nl/sites/stichtingdepijler.nl/themes/pijler/images/nieuwsbrief/header.jpg" height="250px">
        
        
        
        <table width="550px" height="250px" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td height="10px"></td>
              </tr>
              <tr>
                <td height="210px">
                
                <table width="550px" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="10px"></td>
                    <td width="93px"><img src="http://www.stichtingdepijler.nl/sites/stichtingdepijler.nl/themes/pijler/images/nieuwsbrief/logo.png" alt="Stichting de Pijler" border="0"></td>
                    <td>
                    
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td style="color:#FFFFFF; padding-left:10px; font-family:Arial, Helvetica, sans-serif; font-size:10px; text-align:right;"><?php

	 print '<div class="online-link"><a href="http://www.stichtingdepijler.nl' . $base_url.base_path().$node->path . '">Klik hier</a> als de nieuwsbrief niet correct wordt weergegeven</div>'
?></td>
                        <td width="10px"></td>
                      </tr>
                    </table>


</td>
                  </tr>
                </table>
                
                </td>
              </tr>
              <tr>
                <td height="30px" valign="middle">
                
                <table width="550px" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="37px" height="7px"></td>
                    <td height="7px"></td>
                  </tr>
                  <tr>
                    <td width="37px" height="23px"></td>
                    <td height="23px" style="color:#FFFFFF; font-family:Arial, Helvetica, sans-serif; font-size:15px; text-align:left; font-weight:bold;">Stichting de Pijler nieuwsbrief, editie: #<?php print $node->field_nb_editie[0]['view'] ?> - <?php print $node->field_maand_jaar[0]['view'] ?></td>
                  </tr>
                </table>
                
                </td>
              </tr>
        </table>
        
        </td>
      </tr>
    </table>
    <!-- einde tabel top / foto -->
    
     <!-- begin tabel inhoud -->
    <table width="550px" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
        
        <table width="550" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
          <tr>
            <td width="10px"></td>
            <td style="color:#FFFFFF;font-family:Arial, Helvetica, sans-serif; font-size:11px;"><?php print $node->field_nb_content[0]['view'] ?></td>
            <td width="10px"></td>
          </tr>
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
        </table>

		
        
        
        </td>
      </tr>
    </table>
    <!-- einde tabel inhoud -->
    
       <!-- begin tabel nieuws -->
    <table width="550px" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td style="background-color:#0a1489;">
        
        <table width="550" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
          <tr>
            <td width="10px"></td>
            <td style="color:#ffffff; font-family:Arial, Helvetica, sans-serif; font-size:11px;"> <img src="http://www.stichtingdepijler.nl/sites/stichtingdepijler.nl/themes/pijler/images/nieuwsbrief/nieuws-header.png">
            
        
		<?php print $node->field_nb_nieuws[0]['view'] ?></td>
            <td width="10px"></td>
          </tr>
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
        </table>
        
       
        
        </td>
      </tr>
    </table>
    <!-- einde tabel nieuws -->
    
       <!-- begin tabel agenda -->
    <table width="550px" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td style="background-color:#1622b1;">
        
        <table width="550" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
          <tr>
            <td width="10px"></td>
            <td style="color:#ffffff; font-family:Arial, Helvetica, sans-serif; font-size:11px;"> <img src="http://www.stichtingdepijler.nl/sites/stichtingdepijler.nl/themes/pijler/images/nieuwsbrief/agenda-header.png">
            
        
		<?php print $node->field_nb_agenda[0]['view'] ?></td>
            <td width="10px"></td>
          </tr>
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
        </table>
        
        </td>
      </tr>
    </table>
    <!-- einde tabel agenda -->
    
       <!-- begin tabel column -->
    <table width="550px" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td style="background-color:#111c9d;">
        
        <table width="550" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
          <tr>
            <td width="10px"></td>
            <td style="color:#ffffff; font-family:Arial, Helvetica, sans-serif; font-size:11px;"> <img src="http://www.stichtingdepijler.nl/sites/stichtingdepijler.nl/themes/pijler/images/nieuwsbrief/column-header.png">
            
        
		<?php print $node->field_nb_column[0]['view'] ?></td>
            <td width="10px"></td>
          </tr>
          <tr>
            <td width="10px" height="10px"></td>
            <td height="10px"></td>
            <td width="10px" height="10px"></td>
          </tr>
        </table>
        
        </td>
      </tr>
    </table>
    <!-- einde tabel column -->    
    
    </td>
    <td valign="top" style="background-color:#eeeeee;"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="50px" style="background-color:#989898;">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td valign="top" height="50px"></td>
    <td valign="top" height="50px">
            
            <table width="550" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="10px"></td>
          </tr>
          <tr>
            <td style="color:#FFFFFF; font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center;"><a href="http://www.stichtingdepijler.nl" target="_blank" style="color:#ffc000;">Afmelden</a> voor deze nieuwsbrief | meer: <a href="http://www.stichtingdepijler.nl" target="_blank" style="color:#ffc000;">www.stichtingdepijler.nl</a></td>
          </tr>
        </table>
    </td>
    <td valign="top" height="50px"></td>
  </tr>
</table>

</body>

To answer your questions :)
Yes, the node was always there and with several real mailings it's not working. However the testmailings are correctly reseived.

The last question, sending the newsletter without the template I'm now testing.

Maurice0082’s picture

Now it works for me, but only when I do the cron job manual (in drupal or with cron.php)
Still not solved, but one step closer...

You can also check:

- [www.yourdomain.com]/admin/settings/mimemail - settings for html or plain text
- [www.yourdomain.com]/admin/content/node-type/simplenews/display - settings for html or plain text
- try the automatic cron job AND the manual cron job (?)

franz’s picture

Project: Simplenews Template » Simplenews

The markup seems to be that the newsletter was sent in plain format.

The whole issue belongs to Simplenews.

The idea with Simplenews Template is so you DON'T need those files, and can template using the site interface.

sutharsan’s picture

Category: bug » support
Priority: Critical » Normal

Note that the template file name must have a format of: simplenews-newsletter-body--.tpl.php and must not be simplenews-newsletter-body-5.tpl.php

Changing status.

BazzeFTW’s picture

Category: support » bug
Priority: Normal » Critical

There is some sort of problem with this. I have the same issue. Test email looks great, real email just includes the header and footer (simplenews template module) but not the body for some reason. In my case the body consisted of only the number 2 (which is the value in one of my cck fields :S). Very strange.

EDIT: yeah, somehow it doesn't take my template file (and yes it is named correctly, because it worked fine last week) :S

sutharsan’s picture

Category: bug » support
Priority: Critical » Normal

BazzeFTW: I doubt if this is caused by Simplenews. Disable all other related modules and check the content of the emails. Disable: Mime Mail, HTML mail, SMTP, Simplenews Template, any other Simplenews * modules.

Since nobody can make it likeley that these problems are caused by Simplenews, I change the category to Support.

@maurice: Assigning an issue to yourselve means: 'Hands off, I'm working on it' I hope you do!

BazzeFTW’s picture

@Sutharsan: I disabled them all. Still same issue :/

sutharsan’s picture

Have you removed any simplenews-body.tpl.php (or other simplenews* template)?

BazzeFTW’s picture

Nope, I haven't removed anything from the simplenews folder. I have a simplenews-newsletter-body--4.tpl.php in my theme map which get parsed fine when sending a test email but not when sending the real one. The real one just prints out the fields you declared in the "Display fields" under the Simplenews tab. The strangest is that it worked just fine last week and I haven't touched the site since then.

sutharsan’s picture

BazzeFTW’s picture

I already know about that, I have all my tpl in the correct place. But you can't possibly mean that the theme() function will include the tpl files from one directory when sending the test-email and another one when sending the real one? I've even tried putting all the tpl files for the newsletter in all my theme folder just in case.

BazzeFTW’s picture

Okay, I applied this patch: http://drupal.org/files/issues/simplenews.d6_256795_4.patch and now it works.

sutharsan’s picture

Status: Active » Closed (duplicate)

So it turns out this is a duplicate of #256795: Allow simplenews cron to send nodes that anonymous users cannot access.
[edit]: wrong comment removed.