예제 #1
0
파일: index.py 프로젝트: dsilabs/datazoomer
    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()
예제 #2
0
파일: mail.py 프로젝트: robinsax/zoom
    def send_button(self, *args, **input):

        if mail_form.validate(input):

            if False and 'attachment' in input and hasattr(
                    input['attachment'], 'filename'):
                send(
                    input['recipient'],
                    input['subject'],
                    input['message'],
                    [
                        Attachment(
                            input['attachment'].filename,
                            input['attachment'].file,
                        )
                    ],
                )
                success('message sent with attachment')
            else:
                send_as(
                    (input['from_name'], input['from_email']),
                    input['recipient'],
                    input['subject'],
                    input['message'],
                )
                success('message sent')

            return home('mail')
예제 #3
0
def initiate_password_reset(email, fake=False):
    """creates and sends a token to the user"""
    token = make_token(email)
    message = make_message(token)
    if fake:
        return message
    send(email,'Password reset', message)
예제 #4
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()
예제 #5
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()