A Python library to generate a signed email
Project description
python-smime-email
Generate x509 SMIME signed emails with ease!
Usage
-
Generate the email raw content
import smime_email data = b"Hello!" SMIME_KEY = smime_email.load_key("key_path.pem") SMIME_INTERMEDIATE = smime_email.load_certificates("intermediate_path.pem") SMIME_CERT = smime_email.load_certificates("cert_path.pem")[0] email_raw_bytes = smime_email.get_smime_attachment_content(data, SMIME_KEY, SMIME_INTERMEDIATE, SMIME_CERT)
-
Send it using any email library you like. Here is an example as Django email backend
email_raw_bytes = smime_email.get_smime_attachment_content(data, SMIME_KEY, SMIME_INTERMEDIATE, SMIME_CERT) # ... class EmailBackend(BaseEmailBackend): def send_messages(self, message) -> int: with smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT) as server: server.sendmail(message.from_email, message.to, email_raw_bytes) return 1
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smime_email-0.1.0.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for smime_email-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd9f7eb8ed014538bd3cf26d9e376e74db5100d058c43950e83ff5fb1c2a096f |
|
MD5 | 33faeddc5b3b7744308a63e6106ac891 |
|
BLAKE2b-256 | eee1e67f203cfc79afe308c38d7d843d0cc131bd7e3cee763028d1964177bb14 |