Asked  2 Years ago    Answers:  5   Viewed   98 times

Ok so I'm looking to send out a weekly scheduled email with MailChimp. The email is to contain the newest 20 of the stock list (car stocklist of garage) to their subscribers.

I can't seem to get this to work with an RSS feed as imagined so i wondered is there any other way to get some formatted HTML (in a PHP file) into the body of MailChimp template on a weekly basis?

Many thanks.

 Answers

2

If looking to inject custom content into a template at the time of sending, I would recommend having a look into creating a custom template that uses our template language.

If you've created a custom template within MailChimp using our template language to specify editable content areas: http://templates.mailchimp.com/getting-started/template-language/, then you would be able to update those content areas via the API.

To do this, you'll want to make either a campaigns/create call: https://apidocs.mailchimp.com/api/2.0/campaigns/create.php or a campaigns/update call: https://apidocs.mailchimp.com/api/2.0/campaigns/update.php and specify the section and content that you'd like to change as part of the 'content' parameter. the content 'sections' will correspond to the mc:edit tags that were added to the custom template.

You also have the ability to customize your content, like adding a first name to a greeting in the body of your content for instance, even further with the use of merge tags. I highly recommend checking those out as well and consider using them in your content if you need that level of customization: Getting Started with Merge Tags: http://kb.mailchimp.com/merge-tags/using/getting-started-with-merge-tags

Sunday, October 16, 2022
4

Your code looks fairly straightforward and syntactically correct. Is the script returning any error messages?

If you're receiving the message without any issues, then the problem doesn't look to be in your code.

A few things to check:

  • Make sure that the file "matt.txt" is both readable by your webserver and that the path is correct. The path to the file needs to be included in the $mail->AddAttachment() method call and should be relative to the script's location.
  • Verify that your mail server isn't stripping any attachments out due to restrictions and/or try sending a different attachment file type (try a .zip or a .jpg file)
  • If you're running a newer version of phpMailer, you can try catching any exceptions that are thrown (perhaps one that isn't preventing the message from going out, but just preventing the attachment from being included) using the following syntax: (taken from phpMailer Example Code)

    require 'PHPMailer/PHPMailerAutoload.php';
    $mail = new PHPMailer(true);
    try {
    
      $mail->IsSMTP();    // set mailer to use SMTP
      $mail->Host = "SMTP.SErver.com";    
    
      $mail->From = "[email protected]";    
      $mail->FromName = "HCSC";  
      $mail->AddAddress("[email protected]", "Example"); 
      $mail->AddReplyTo("[email protected]", "Hcsc"); 
    
      $mail->WordWrap = 50;    
      $mail->IsHTML(false);    
    
      $mail->Subject = "AuthSMTP Test";
      $mail->Body    = "AuthSMTP Test Message!";
      $mail->AddAttachment("matt.txt");
      echo "Message Sent OK<p></p>n";
    
    } catch (phpmailerException $e) {
    
      echo $e->errorMessage(); //Pretty error messages from PHPMailer
    
    } catch (Exception $e) {
    
      echo $e->getMessage(); //Boring error messages from anything else!
    
    }
    
Sunday, September 4, 2022
 
denny
 
1
app.controller('MainCtrl', function($scope,$compile) {

    var btnhtml = '<button type="button" ng-click="addButton()">Click Me</button>';
    var temp = $compile(btnhtml)($scope);

    //Let's say you have element with id 'foo' in which you want to create a button
    angular.element(document.getElementById('foo')).append(temp);

   var addButton = function(){
       alert('Yes Click working at dynamically added element');
   }

});

you need to add $compile service here, that will bind the angular directives like ng-click to your controller scope. and dont forget to add $compile dependency in your controller as well like below.

here is the plunker demo

Tuesday, October 4, 2022
 
4

I feel your pain, I've had the same issue for templates I was making for a client. I wanted to make the icons retina proof and let the client upload any image size he'd like. Unfortunately after many many hours debugging en searching the web, I read the following on a MailChimp post:

Outlook doesn’t recognize the HTML that constrains images. This means that if you use HTML to resize an image uploaded to a campaign or template, it may display at the original size in Outlook. Be sure to resize your images before you upload them to MailChimp, or use our built-in image editor.

source: MailChimp Knowledge Base

I didn't really believe that this could actually be true so I kept trying to constrain the images. I've put fixed width on the img, td, tr, table.. nothing helped.

Sadly I can't really explain what happens, hopefully the link to the MC article gives you a better view on it. But my best answer is to set a max-width & width to your img and td anyway. And tell your client to resize the images to the allowed size. Setting a max-width and width will also display the #px when hovering over the editable image in your MailChimp editor. I also found out that when you do upload a bigger size, MailChimp throws a lil' warning.

If it may help in any way; see my code below that I used in my templates to make it fluid.

<table mc:repeatable mc:variant="Item with image top and CTA" width="650" cellpadding="0" cellspacing="0" border="0" align="center" class="full-table" style="width:650px;">
<tr>
  <td style="padding:30px 20px 40px 20px;" bgcolor="#FFFFFF">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td style="padding-bottom:15px;max-width:610px;">
          <img src="/images/img.jpg" alt="x" style="width:100%; max-width:610px;" width="610" mc:edit="article_image">
        </td>
      </tr>
    </tr>
  </table>
</td>

Friday, November 25, 2022
2

TreeItems represent the data, not the UI component. So they don't generate mouse events. You need to register the mouse listener on the TreeCell. To do this, set a cell factory on the TreeView. The cell factory is a function that creates TreeCells as they are needed. Thus this will work for dynamically added tree items too.

You will need something like this:

TreeView<String> treeView ;

// ...

treeView.setCellFactory( tv -> {
    TreeCell<String> cell = new TreeCell<>();
    cell.textProperty().bind(cell.itemProperty());
    cell.addEventHandler(MouseEvent.MOUSE_CLICKED, event -> {
        if (! cell.isEmpty()) {
            String value = cell.getItem();
            TreeItem<String> treeItem = cell.getTreeItem(); // if needed
            // process ...
        }
    });
    return cell ;
}
Thursday, September 15, 2022
 
nl-x
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 

Browse Other Code Languages