Exemplo n.º 1
0
    def send_button(self, **input):

        if mail_form.validate(input):

            if 'ENCRYPT' in input:

                try:
                    send_secure( input['RECIPIENT'], input['SUBJECT'], input['MESSAGE'] )
                    message('encrypted message sent')
                    return home()

                except RecipientKeyMissing, e:
                    error('Missing pulic key for %s'%e.message)

            else:
                if 'ATTACHMENT' in input and hasattr(input['ATTACHMENT'], 'filename'):
                    send(
                        input['RECIPIENT'],
                        input['SUBJECT'],
                        input['MESSAGE'],
                        [Attachment(
                            input['ATTACHMENT'].filename,
                            input['ATTACHMENT'].file,
                        )],
                    )
                    message('message sent with attachment')
                else:
                    send(input['RECIPIENT'], input['SUBJECT'], input['MESSAGE'])
                    message('message sent')
                return home()
Exemplo n.º 2
0
    def send_button(self, **input):

        if mail_form.validate(input):

            if 'ENCRYPT' in input:

                try:
                    send_secure(input['RECIPIENT'], input['SUBJECT'],
                                input['MESSAGE'])
                    message('encrypted message sent')
                    return home()

                except RecipientKeyMissing, e:
                    error('Missing pulic key for %s' % e.message)

            else:
                if 'ATTACHMENT' in input and hasattr(input['ATTACHMENT'],
                                                     'filename'):
                    send(
                        input['RECIPIENT'],
                        input['SUBJECT'],
                        input['MESSAGE'],
                        [
                            Attachment(
                                input['ATTACHMENT'].filename,
                                input['ATTACHMENT'].file,
                            )
                        ],
                    )
                    message('message sent with attachment')
                else:
                    send(input['RECIPIENT'], input['SUBJECT'],
                         input['MESSAGE'])
                    message('message sent')
                return home()
Exemplo n.º 3
0
    def send_button(self, **input):

        if mail_form.validate(input):

            if 'ENCRYPT' in input:

                try:
                    send_secure( input['RECIPIENT'], input['SUBJECT'], input['MESSAGE'] )
                    message('encrypted message sent')
                    return home()

                except RecipientKeyMissing, e:
                    error('Missing pulic key for %s'%e.message)

            else:
                send( input['RECIPIENT'], input['SUBJECT'], input['MESSAGE'] )
                message('message sent')
                return home()