def gotInvite(self, invite):
        time.sleep(1)
        print()
        ps = input("Print, Save, or Email [P/s/e]? ")
        passwd = input("Encrypt invite with password: "******"Save invite to filename: ").strip()
            if filename != '':
                f = open(filename, 'wb')
                f.write(packet.packet)
                f.close()
        elif ps == 'e':
            frm = input("Your email: ")
            to = input("Recipient email: ")
            name = input("Your name on DustMail: ")

            body = """
      You have been invited to communicate with %s via DustMail.
      Use the following invite code: %s
      """ % (name, encode(packet.packet))

            emailConfig = YamlMap('config/emailServer.yaml')
            try:
                smtpHost = emailConfig['smtpHost']
            except:
                smtpHost = input("SMTP Host: ")
                emailConfig['smtpHost'] = smtpHost

            notifier = Notifier(frm)
            notifier.notify(to, 'DustMail Invite', body)
        else:
            print()
            print(encode(packet.packet))
            print()

        self.commandDone.set()
    def sendMessage(self, message):
        print('sendMessage ' + str(message))

        onion = OnionPacket()
        onion.decodeOnionPacket(self.router.keys.getKeypair(), decode(message))
        frm = encode(onion.sender)
        to = encode(onion.receiver)

        print('frm: ' + str(frm))
        print('to: ' + str(to))

        if not os.path.exists(self.maildir + '/' + to):
            os.mkdir(self.maildir + '/' + to)

        filename = None
        while not filename or os.path.exists(filename):
            filename = self.makeName(frm, to)
        f = open(filename, 'w')
        f.write(message)
        f.close()

        notifyPrefs = YamlMap('config/dustmail-notify.yaml')
        try:
            mailAddr = notifyPrefs[to]

            addressBook = YamlMap('config/dustmail-addressbook.yaml')
            frmName = self.nameForPubkey(addressBook, frm)
            if not frmName:
                frmName = frm

            notifier = Notifier('*****@*****.**')
            notifier.notify(
                mailAddr, 'New DustMail Message',
                "You have a DustMail message from " + frmName + ".")
        except KeyError:
            print('No notification set')