Skip to Content.
Sympa Menu

en - RE: [sympa-users] Question Regarding Mail Merge Feature

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Patrick Rynhart <address@concealed>
  • To: Steve Shipway <address@concealed>
  • Cc: "address@concealed" <address@concealed>, "address@concealed" <address@concealed>
  • Subject: RE: [sympa-users] Question Regarding Mail Merge Feature
  • Date: Tue, 6 May 2014 18:28:33 +1200 (NZST)

Great, thanks Steve. I see similiar code in List.pm, so I will experiment tomorrow.

Ultimately, where are these 'globals' coming from ? Are they from the parent sympa.pl process ?

It looks as though no significant overhead will be added as a result of doing this (as the structs/data are actually available the whole time).

Thanks again,

Patrick

On Tue, 6 May 2014, Steve Shipway wrote:

If you want to add new things to the Stash for mailmerge, the place to do it
is in the merge_msg() function in Bulk.pm.

The variable $data is a pointer to a hash that is passed to TT2 as the
stash. So, for example, if you do this:

$data->{list}{custom_var}{foo} = 1

Then in your mailmerge, you'll be able to have [% list.custom_var.foo %]

Of course, you'll probably want to properly populate the $data->{list} hash
with a few more things, as well, such as

my $list = new List($bulk->{listname},$bulk->{robot});
$data->{list}{name} = $bulk->{listname};
if (defined $list->{'admin'}{'custom_vars'}) {
$data->{list}{'custom_vars'} = {};
foreach my $var (@{$list->{'admin'}{'custom_vars'}}) {
$data->{list}{'custom_vars'}{$var->{'name'}} = $var->{'value'};
}
}

This is off of the top of my head though so you'd probably want to
experiment

Steve

Steve Shipway
address@concealed






Archive powered by MHonArc 2.6.19+.

Top of Page