
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
The Chalice-Mail
extension provides a simple interface to set up SMTP and AWS SES(Simple Email Service) with your Chalice application and to send messages from your views and scripts.
source code available at: Github Repo
from chalice import Chalice
from chalice_mail import Mail, Message
app = Chalice(app_name='chalice-mail-test1')
mail = Mail(app)
mail.is_smtp = True
mail.smtp_using_tls = True
mail.username = "someone@example.com"
mail.password = "world's_top_secret_password"
mail.smtp_server = 'smtp.example.com'
mail.smtp_port = 587
mail.login()
@app.route('/send-smtp-mail')
def send_smtp_mail():
msg = Message(mail)
msg.subject = "this is the subject"
msg.add_recipient("aniketsarkar@yahoo.com")
msg.plain = "This is the email body."
mail.send_email(msg)
return {'message':'email sended successfully'}
from chalice import Chalice
from chalice_mail import Mail, Message
app = Chalice(app_name='chalice-mail-test1')
mail = Mail(app)
mail.is_smtp = True
mail.smtp_using_ssl = True
mail.username = "someone@example.com"
mail.password = "world's_top_secret_password"
mail.smtp_server = 'smtp.example.com'
mail.smtp_port = 465
mail.login()
@app.route('/send-smtp-mail')
def send_smtp_mail():
msg = Message(mail)
msg.subject = "this is the subject"
msg.add_recipient("aniketsarkar@yahoo.com")
msg.plain = "This is the email body."
mail.send_email(msg)
return {'message':'email sended successfully'}
from chalice import Chalice
from chalice_mail import Mail, Message
app = Chalice(app_name='chalice-mail-test1')
mail = Mail(app)
mail.username = "someone@example.com"
mail.aws_region = "ap-south-1"
"""
please provide the value of 'mail.aws_secret_id'
and 'mail.aws_secret_key' if you want to set the AWS
Iam user manually.
"""
mail.login()
@app.route('/send-smtp-mail')
def send_smtp_mail():
msg = Message(mail)
msg.subject = "this is the subject"
msg.add_recipient("aniketsarkar@yahoo.com")
msg.plain = "This is the email body."
mail.send_email(msg)
return {'message':'email sended successfully'}
from chalice import Chalice
from chalice_mail import Mail, Message
app = Chalice(app_name='chalice-mail-test1')
mail = Mail(app)
mail.is_smtp = True
mail.smtp_using_tls = True
mail.username = "someone@example.com"
mail.password = "world's_top_secret_password"
mail.smtp_server = 'smtp.example.com'
mail.smtp_port = 587
mail.login()
@app.route('/send-smtp-mail')
def send_smtp_mail():
msg = Message(mail)
msg.subject = "this is the subject"
msg.add_recipient("aniketsarkar@yahoo.com")
"""
Simply pass the html value to the html variable of Message instance.
"""
msg.html = "<h1>This is the email body.</h1>"
mail.send_email(msg)
return {'message':'email sended successfully'}
from chalice import Chalice
from chalice_mail import Mail, Message
from pathlib import Path
from os import path
app = Chalice(app_name='chalice-mail-test1')
_baseDir = Path(path.realpath(__file__)).parent
mail = Mail(app)
mail.is_smtp = True
mail.smtp_using_tls = True
mail.username = "someone@example.com"
mail.password = "world's_top_secret_password"
mail.smtp_server = 'smtp.example.com'
mail.smtp_port = 587
mail.template_dir = _baseDir/'templates' # required if using template rendering.
mail.login()
@app.route('/send-smtp-mail')
def send_smtp_mail():
msg = Message(mail)
msg.subject = "this is the subject"
msg.add_recipient("aniketsarkar@yahoo.com")
context={}
"""
This package comes with the jinja2 based template rendering system.
Simpley use the 'render_template()' function to rend the html file.
'render_template()' functions takes the html file name as arguments
and the context as well as.
"""
msg.html = mail.render_template('index.html', context)
mail.send_email(msg)
return {'message':'email sended successfully'}
from chalice import Chalice
from chalice_mail import Mail, Message
from pathlib import Path
from os import path
app = Chalice(app_name='chalice-mail-test1')
_baseDir = Path(path.realpath(__file__)).parent
mail = Mail(app)
mail.is_smtp = True
mail.smtp_using_tls = True
mail.username = "someone@example.com"
mail.password = "world's_top_secret_password"
mail.smtp_server = 'smtp.example.com'
mail.smtp_port = 587
mail.attachment_dir = _baseDir/'attachments' # required if using attachments.
mail.login()
@app.route('/send-smtp-mail')
def send_smtp_mail():
msg = Message(mail)
msg.subject = "this is the subject"
msg.add_recipient("aniketsarkar@yahoo.com")
msg.plain = "This is the email body."
"""
Use the 'add_attachments()' function to add the attachments
with the message instance. Don't forget to put the attachments
on the attachments folder.
'add_attachments()' function basically takes list or str data
type as argument. If you want to add only one attachment just pass
the attachment name. If you want to add more than one attachments use a list.
"""
msg.add_attachments(['python.png', 'README.rst'])
mail.send_email(msg)
return {'message':'email sended successfully'}
chalice-mail
is available from pypi
.
pip install chalice-mail
git clone https://github.com/marktennyson/chalice-mail && cd chalice-mail
python setup.py install --user
chalice-mail
is compatiable with python3.6 and higher versions.
Not compatiable for Python version 2.
We welcome contributions of all types!
FAQs
SMTP and SES mail integration with AWS Chalice
We found that chalice-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 flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.