Code to validate the input:

```
public function rules() { 
    return [ [['name', 'email', 'subject', 'content'], 'required'], 
             [['date_added'], 'safe'],
             [['email', 'subject'], 'string', 'max' => 255], [['email'], 'email'], 
]; } 

```