
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
This is a simple Python library for sending emails. It provides an easy way to configure and send emails from any Python code.
To install the imhotep_mail
library, you can use pip:
pip install imhotep-mail
The recommended way to use the library is by configuring SMTP settings globally using the set_mail_config
function:
from imhotep_mail import set_mail_config
# Set global SMTP configuration
set_mail_config(
smtp_server='smtp.example.com',
smtp_port=465,
username='your-email@example.com',
password='your-password',
user_tls=True, # Optional, default is True
user_ssl=False # Optional, default is False
)
Then, send emails using the send_mail
function:
from imhotep_mail import send_mail
# Sending an email
success, error = send_mail(
to_email='recipient@example.com',
subject='Hello from Imhotep Mail!',
body='This is a test email sent using the Imhotep Mail library.',
is_html=False
)
if error:
print(f"Error: {error}")
else:
print(success)
For backward compatibility, you can still use the send_mail
function by passing SMTP configuration directly. This method is not recommended for new code:
from imhotep_mail import send_mail
# Sending an email using the legacy method
success, error = send_mail(
'smtp.example.com', 465, 'your-email@example.com', 'your-password',
to_email='recipient@example.com',
subject='Hello from Imhotep Mail!',
body='This is a test email sent using the Imhotep Mail library.',
is_html=False
)
if error:
print(f"Error: {error}")
else:
print(success)
If you are using Gmail, you need to enable "App Passwords" to use this library. Follow these steps:
set_mail_config
function.Example:
from imhotep_mail import set_mail_config, send_mail
# Set global SMTP configuration for Gmail
set_mail_config(
smtp_server='smtp.gmail.com',
smtp_port=587,
username='your-email@gmail.com',
password='your-app-password',
user_tls=True,
user_ssl=False
)
# Send an email
success, error = send_mail(
to_email='recipient@example.com',
subject='Hello from Imhotep Mail!',
body='This is a test email sent using Gmail with App Passwords.',
is_html=False
)
if error:
print(f"Error: {error}")
else:
print(success)
Both methods support sending emails with attachments. For example, using the recommended method:
from imhotep_mail import send_mail
# Sending an email with attachments
success, error = send_mail(
to_email='recipient@example.com',
subject='Hello from Imhotep Mail!',
body='This is a test email sent using the Imhotep Mail library.',
is_html=False,
attachments=['path/to/attachment1.pdf', 'path/to/attachment2.jpg']
)
if error:
print(f"Error: {error}")
else:
print(success)
The library also provides a CLI tool for sending emails. To use it, run the following command:
imhotep-mail-cli --to recipient@example.com --subject "Hello from CLI" --body "This is a test email sent using the CLI." --is-html --attachments path/to/attachment1.pdf path/to/attachment2.jpg --smtp-server smtp.gmail.com --smtp-port 587 --smtp-username your-email@gmail.com --smtp-password your-app-password --use-tls
--to
: Recipient email address (required).--subject
: Email subject (required).--body
: Email body (required).--is-html
: Send email as HTML (optional).--attachments
: Paths to attachment files (optional).--smtp-server
: SMTP server address (optional, overrides environment variables).--smtp-port
: SMTP server port (optional, overrides environment variables).--smtp-username
: SMTP username (optional, overrides environment variables).--smtp-password
: SMTP password (optional, overrides environment variables).--use-tls
: Use TLS for SMTP (optional).--use-ssl
: Use SSL for SMTP (optional).Contributions are welcome! You can submit issues and pull requests to help improve the library.
MIT License. See LICENSE for more information.
FAQs
A python library to send mails easily
We found that imhotep-mail demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.