def send_message(to, text, sender=None):
 if sender:
  msg = OutboxMessage.objects.create(sender=sender, message=text)
  msg.to.add(*to)
 for user in to:
  im = InboxMessage.objects.create(sender=sender, to=user, message=text)
  if Setting.get_for_user(user, 'email_private_messages'):
   email_private_message(inbox_message_id=im.id)
 message_sent.send(sender=InboxMessage, to=to, text=text, msg_sender=sender)

def send_message ( to , text , sender = None ) : if sender : msg = OutboxMessage . objects . create ( sender = sender , message = text ) msg . to . add ( * to ) for user in to : im = InboxMessage . objects . create ( sender = sender , to = user , message = text ) if Setting . get_for_user ( user , 'email_private_messages' ) : email_private_message ( inbox_message_id = im . id ) message_sent . send ( sender = InboxMessage , to = to , text = text , msg_sender = sender )
send a private message .