Sometimes you’re in the need to add some custom dynamic content to your newsletters. You may use it for coupon codes, custom status or even the weather in a specific region. To achieve that you can start with this snippet

if ( function_exists( 'mailster_add_tag' ) ) {
  function mytag_function($option, $fallback, $campaignID = NULL, $subscriberID = NULL){
    return 'My Tag: Option: '.$option."; Fallback: ".$fallback;
  mailster_add_tag('mytag', 'mytag_function');


If you add this to your themes function.php you can now use  {mytag} in your newsletters.
If you like to add options to the tag like {mytag:my_option} you find this value in the $option variable
To define a fallback value in your tag use {mytag|my_fallback} or {mytag:my_option|my_fallback} to add ‘my_fallback’ in the $fallback variable