The inverse of :func:`encrypt_email`.

    :param enc_email:
        The encrypted email address.
331415
def decrypt_email(enc_email):
    
    aes = SimpleAES(flask.current_app.config["AES_KEY"])
    return aes.decrypt(enc_email)
168808
def Email(
        self,
        From,
        To,
        Cc=None,
        Bcc=None,
        Subject=None,
        Tag=None,
        HtmlBody=None,
        TextBody=None,
        Metadata=None,
        ReplyTo=None,
        Headers=None,
        TrackOpens=None,
        TrackLinks="None",
        Attachments=None,
    ):
        
        return Email(
            manager=self,
            From=From,
            To=To,
            Cc=Cc,
            Bcc=Bcc,
            Subject=Subject,
            Tag=Tag,
            HtmlBody=HtmlBody,
            TextBody=TextBody,
            Metadata=Metadata,
            ReplyTo=ReplyTo,
            Headers=Headers,
            TrackOpens=TrackOpens,
            TrackLinks=TrackLinks,
            Attachments=Attachments,
        )
225782
def encrypt(clear_text) -> str:
        
        if not isinstance(clear_text, bytes):
            clear_text = str.encode(clear_text)
        cipher = Fernet(current_app.config['KEY'])
        return cipher.encrypt(clear_text).decode("utf-8")
315767
def encrypt_password(**kwargs):
    
    new_value = kwargs['new_value']
    field = kwargs['field']
    min_length = field.params['min_length']
    if len(new_value) < min_length:
        raise ValueError(
            '`{}`: Value length must be more than {}'.format(
                field.name, field.params['min_length']))

    if new_value and not crypt.match(new_value):
        new_value = str(crypt.encode(new_value))
    return new_value
214563
def encrypt_message(self, reply, timestamp=None, nonce=None):
        
        if hasattr(reply, "render"):
            reply = reply.render()

        timestamp = timestamp or to_text(int(time.time()))
        nonce = nonce or generate_token(5)
        encrypt = to_text(self.prp_crypto.encrypt(reply, self.app_id))
        signature = get_signature(self.token, timestamp, nonce, encrypt)
        return to_text(
            self.ENCRYPTED_MESSAGE_XML.format(
                encrypt=encrypt,
                signature=signature,
                timestamp=timestamp,
                nonce=nonce
            )
        )
1334347
def verify_email_for_object(self, email, content_object, email_field_name='email'):
        

        confirmation_key = generate_random_token()

        try:
            confirmation = EmailConfirmation()
            confirmation.content_object = content_object
            confirmation.email_field_name = email_field_name
            confirmation.email = email
            confirmation.confirmation_key = confirmation_key
            confirmation.save()
        except IntegrityError:
            confirmation = EmailConfirmation.objects.get_for_object(content_object, email_field_name)
            confirmation.email = email
            confirmation.confirmation_key = confirmation_key
            confirmation.save(update_fields=['email', 'confirmation_key'])

        confirmation.send()

        return confirmation
1190412
def from_EmailMessage(cls, message):
        
        mail = cls(
            from_email=Email(message.get('From')),
            subject=message.get('Subject'),
            to_emails=Email(message.get('To')),
        )
        try:
            body = message.get_content()
        except AttributeError:
            # Python2
            body = message.get_payload()
        mail.add_content(Content(
            message.get_content_type(),
            body.strip()
        ))
        for k, v in message.items():
            mail.add_header(Header(k, v))
        return mail
1173867
def encrypt(self, password):
        
        if not password or not self._crypter:
            return password or b''
        return self._crypter.encrypt(password)
878832
def get_by_email(cls, email):
        
        return cls.query().filter(cls.email == email).first()
1066793
def GetUserByEmail(self, email):
    
    user = self.rpc_helper.GetAccountInfoByEmail(email)
    return GitkitUser.FromApiResponse(user)
264292
def get_contact_by_email(self, email):
        
        if not email:
            return None

        email = email.strip()

        url = self.build_url('{}/{}'.format(self._endpoints.get('gal'), email))

        response = self.con.get(url)
        if not response:
            return []

        data = response.json()

        # Everything received from cloud must be passed as self._cloud_data_key
        return self.contact_constructor(parent=self,
                                        **{self._cloud_data_key: data})
214352
function encodeEmailwithSubject($email, $name = null, $sujet="")
    {
        $email = preg_replace("/\"/", "\\\"", $email);

        if ($name == null) {
            $name = $email;
        }

        $old1 = "document.write('<a class=lien href=\"mailto:$email?subject=";
        //".$sujet."
        $old2= "\">$name</a>')";



        $output1 = "";

        for ($i=0; $i < pia_strlen($old1); $i++) {
            $output1 = $output1 . '%' . bin2hex(pia_substr($old1, $i, 1));
        }

        $output2 = "";

        for ($i=0; $i<pia_strlen($old2); $i++) {
            $output2 = $output2 .'%'.bin2hex(pia_substr($old2, $i, 1));
        }


        $output="";
        $output = '<script type="text/javascript">eval(unescape(\''.
            $output1.'\')+"'.$sujet.'"+unescape(\''.$output2.'\'))</script>';
        $output .= '<noscript><div>Vous devez accepter le Javascript'.
            ' pour voir l\'email</div></noscript>';
        return $output;
    }
676858
def encrypt_text(self, text, *args, **kwargs):
        
        b = text.encode("utf-8")
        token = self.encrypt(b, *args, **kwargs)
        return base64.b64encode(token).decode("utf-8")
1269514
def encrypt(self, paddedMessage):
        
        # TODO: make this less ugly and python 2 and 3 compatible
        # paddedMessage = bytearray(paddedMessage.encode() if (sys.version_info >= (3, 0) and not type(paddedMessage) in (bytes, bytearray)) or type(paddedMessage) is unicode else paddedMessage)
        if (sys.version_info >= (3, 0) and
                not type(paddedMessage) in (bytes, bytearray)) or type(paddedMessage) is unicode:
            paddedMessage = bytearray(paddedMessage.encode())
        else:
            paddedMessage = bytearray(paddedMessage)

        sessionRecord = self.sessionStore.loadSession(self.recipientId, self.deviceId)
        sessionState = sessionRecord.getSessionState()
        chainKey = sessionState.getSenderChainKey()
        messageKeys = chainKey.getMessageKeys()
        senderEphemeral = sessionState.getSenderRatchetKey()
        previousCounter = sessionState.getPreviousCounter()
        sessionVersion = sessionState.getSessionVersion()

        ciphertextBody = self.getCiphertext(sessionVersion, messageKeys, paddedMessage)
        ciphertextMessage = WhisperMessage(sessionVersion, messageKeys.getMacKey(),
                                           senderEphemeral, chainKey.getIndex(),
                                           previousCounter, ciphertextBody,
                                           sessionState.getLocalIdentityKey(),
                                           sessionState.getRemoteIdentityKey())

        if sessionState.hasUnacknowledgedPreKeyMessage():
            items = sessionState.getUnacknowledgedPreKeyMessageItems()
            localRegistrationid = sessionState.getLocalRegistrationId()

            ciphertextMessage = PreKeyWhisperMessage(sessionVersion, localRegistrationid, items.getPreKeyId(),
                                                     items.getSignedPreKeyId(), items.getBaseKey(),
                                                     sessionState.getLocalIdentityKey(),
                                                     ciphertextMessage)
        sessionState.setSenderChainKey(chainKey.getNextChainKey())
        self.sessionStore.storeSession(self.recipientId, self.deviceId, sessionRecord)

        return ciphertextMessage
1211494
def construct_message(self, email=None):
        
        # add subject, from and to
        self.multipart['Subject'] = self.subject
        self.multipart['From'] = self.config['EMAIL']
        self.multipart['Date'] = formatdate(localtime=True)
        if email is None and self.send_as_one:
            self.multipart['To'] = ", ".join(self.addresses)
        elif email is not None and self.send_as_one is False:
            self.multipart['To'] = email
        # add ccs
        if self.ccs is not None and self.ccs:
            self.multipart['Cc'] = ", ".join(self.ccs)
        # add html and text body
        html = MIMEText(self.html, 'html')
        alt_text = MIMEText(self.text, 'plain')
        self.multipart.attach(html)
        self.multipart.attach(alt_text)
        for file in self.files:
            self.multipart.attach(file)
1116894
def encrypt(plain)
      fail ArgumentError, 'No plain text supplied.' if plain.nil? || plain.empty?

      cipher = self.class.cipher
      cipher.encrypt
      cipher.key = Base64.decode64(@key)
      cipher.iv = iv = cipher.random_iv
      encrypted = cipher.update(plain)
      encrypted << cipher.final

      iv = Base64.strict_encode64(iv)
      encrypted = Base64.strict_encode64(encrypted)

      "$#{iv}$#{encrypted}"
    end
329962
def change_email(self, email):
        

        def cb():
            if not utils.is_email_valid(email):
                raise exceptions.AuthError("Email address invalid")
            self.user.change_email(email)
            return email

        return signals.user_update(self, ACTIONS["EMAIL"], cb,
                                   {"email": self.email})