def new_message(self, recipient_type=RecipientType.TO, *, query=None):
        """ This method returns a new draft Message instance with all the
        contacts first email as a recipient

        :param RecipientType recipient_type: section to add recipient into
        :param query: applies a OData filter to the request
        :type query: Query or str
        :return: newly created message
        :rtype: Message or None
        """

        if isinstance(recipient_type, str):
            recipient_type = RecipientType(recipient_type)

        recipients = [contact.emails[0]
                      for contact in self.get_contacts(limit=None, query=query)
                      if contact.emails and contact.emails[0].address]

        if not recipients:
            return None

        new_message = self.message_constructor(parent=self, is_draft=True)
        target_recipients = getattr(new_message, str(recipient_type.value))
        target_recipients.add(recipients)

        return new_message
def new_message ( self , recipient_type = RecipientType . TO , * , query = None ) : if isinstance ( recipient_type , str ) : recipient_type = RecipientType ( recipient_type ) recipients = [ contact . emails [ 0 ] for contact in self . get_contacts ( limit = None , query = query ) if contact . emails and contact . emails [ 0 ] . address ] if not recipients : return None new_message = self . message_constructor ( parent = self , is_draft = True ) target_recipients = getattr ( new_message , str ( recipient_type . value ) ) target_recipients . add ( recipients ) return new_message
This method returns a new draft Message instance with all the
        contacts first email as a recipient

        :param RecipientType recipient_type: section to add recipient into
        :param query: applies a OData filter to the request
        :type query: Query or str
        :return: newly created message
        :rtype: Message or None