Dennis
7/31/2019 - 2:24 PM

mailinglist - Newsletter

HTML object

<!--%%[ 
/* Set de code hier */
IF EMPTY(@code) THEN
  SET @code = 'Nieuwsbrief'
ELSE
  RaiseError(Concat('There is already a mailinglist code selected in this email. The selected mailinglist code is: ',@code),false)
ENDIF


/* Mailinglijst niveau */
SET @rows = LookupRows("FS Mailinglists config","mailinglist_code",@code)
IF RowCount(@rows) > 0 THEN
  SET @row = Row(@rows,1)
  SET @dataextension_name = Field(@row,"dataextension_name")
  SET @amountInDE = DataExtensionRowCount(@dataextension_name)  
  
   IF @amountInDE > 0 THEN
     /* Set de rest van de velden */
     SET @mailinglist_name = Field(@row,"mailinglist_name")
     SET @unsubscribe_link = Field(@row,"unsubscribe_link")
     SET @subscribe_link = Field(@row,"subscribe_link")
     SET @preference_center = Field(@row,"preference_center")
   ELSE
     RaiseError('Mailinglijst wel gevonden maar er zit niemand in.',false)
   ENDIF 
ELSE
   RaiseError(Concat('De code van deze mailinglijst is onjuist. Controleer of de code "',@code,'" in de data extensie "FS Mailinglists config" zit.'),false)
ENDIF

/* Subscriber niveau */
SET @rows = LookupRows(@dataextension_name,"Contact ID",[Contact ID])
IF RowCount(@rows) > 0 THEN
  /* KLant gevonden. Selecteer de rij en map de benodigde waarde */
  SET @row = Row(@rows,1)
  SET @memberID = LongSFID(Field(@row,"member ID"))
  SET @unsubscribeURL = Concat(@unsubscribe_link,'?id=',subscriberID,'&hash=',@hash,'&cmid=',@memberID,'&jobid=',jobid) 
  SET @block_message = Concat('<br><span style="font-size:12px;line-height:12px;color:#ffffff;">', @amountInDE, ' active subscribers</span>')
  
ELSE
  SET @mailinglist_Message = Concat('Subscriber staat niet in de mailinglijst: ',@dataextension_name)
  UpsertDE("Invalid subscriber mailinglist_log",2,"JobID",jobid,"SubscriberKey",_subscriberkey,"EmailName",emailName_,"ErrorMessage",@mailinglist_Message,"EmailAddress",emailaddr)
  RaiseError(@mailinglist_Message,true)
  
ENDIF

IF _messagecontext == "PREVIEW" THEN
]%%-->
<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0" class="fluid-centered">
  <tr>
   <td bgcolor="#009de0" align="center" valign="top" style="color:#ffffff;padding:15px; border:1px dotted #666666;">
  Selected Mailinglist code: Nieuws
     <span style="font-size:0;line-height:0;">%%=v(@block_message)=%%</span>
</td>
  </tr>
</table>
<!--%%[ENDIF]%%-->