function custom_easymail_auto_add_subscriber_to_list_by_post ( $subscriber, $user_id=false ) {
global $post;
if ( is_singular() && is_object($post) ) {
switch( $post->ID ) {
// List of post IDs and related lists
case 1:
case 2:
$list_id = 1; // put the ID of mailing list
break;
case 3:
$list_id = 2; // put the ID of mailing list
break;
// etc etc ........
// A default list
default:
$list_id = 3; // put the ID of mailing list
}
alo_em_add_subscriber_to_list ( $subscriber->ID, $list_id );
}
}
add_action ( "alo_easymail_new_subscriber_added", "custom_easymail_auto_add_subscriber_to_list_by_post", 10, 2 );