Forms & Actions > Forms - Recipient management > Forms > Sending the last newsletter just after subscription

Sending the last newsletter just after subscription

There is the possibility to send new subscribers the latest newsletter just after their subscription. The advantage is clear: In the moment of subscription, the person has a strong desire to get your newsletter. So why let him/her wait until the next issue when you can send the latest newsletter right away. If your latest newsletter was going to a specific target group, the new subscriber will only receive it, if he belongs to that target group.

The setup of this feature is quite easy: You just have to modify your existing action for subscription. Choose your action for subscription from the action overview and add the following points (it makes sense to change the description, so you can remember your change). In the section Add step, choose Script-Action and click on Add. Now copy the following code:

#set($last=$ScriptHelper.findLastNewsletter($customerID, 1, <mailinglistID>))
#set ($mail=$MailingDao.getMailing($last, 1))
#if($mail)
$mail.sendEventMailing($customerID.intValue(), 0, "1", null, $ScriptHelper.getApplicationContext())
#end
#set($scriptResult="1")

Click on Save and the action is activated. You may want to check your changes by subscribing a new address.

Fig. 8.17: A simple script is added to the Subscribe action.

Fig. 8.17: A simple script is added to the Subscribe action.