---
title: containsValid
slug: campaign/docs/containsvalid
docTags: 
createdAt: 2026-07-02T19:01:45.941Z
---

Queries whether a recipient can receive mailings (is valid) in Optimizely Campaign by checking the following conditions:

- already exists in a recipient list
- is not blocked in a recipient list
- is not unsubscribed in a recipient list
- is not bounced-out in a recipient list
- has finished an opt-in process (if any opt-in process exists) in a recipient list

By default, the media type EMAIL is used. Use the [setMediaType](docId\:ElqHgIk1SYriXO5Zw18T-) method to select another media type such as SMS.

**Type**: boolean

**Parameters**

| Name            | Type   | Value                    |
| --------------- | ------ | ------------------------ |
| sessionId       | String | ID of the session        |
| recipientListId | long   | ID of the recipient list |
| recipientId     | String | ID of the recipient      |

**Return values**

- true: Recipient matches all conditions and receives mailings
- false: Recipient does not match at least one condition and does not receive any mailing

**Code structure**

```javascript
boolean containsValid(String sessionId, long recipientListId, String recipientId)
```
