Giter VIP home page Giter VIP logo

marktennyson / flask-mailing Goto Github PK

View Code? Open in Web Editor NEW
32.0 4.0 10.0 966 KB

Flask-Mailing is the ultimate solution for sending emails asynchronously in Flask applications. With its extensive features such as support for multiple email providers, file attachments, customizable templates, and encryption, Flask-Mailing makes email communication effortless and efficient.

Home Page: https://gh.aniketsarkar.site/flask-mailing/

License: MIT License

HTML 0.71% Python 98.54% Makefile 0.75%
flask flask-mail python smtp async mail aiosmtpd email asynchronous-mailing asynchronous-programming

flask-mailing's Introduction

Profile views

Hello world, I'm Aniket Sarkar - aka marktennyson👋

I, a seasoned Full Stack Developer and AWS Cloud Architect, ardently traverse the realms of ethical hacking, championing the cause of open-source technologies, and delving into the intricacies of blockchain as a dedicated researcher. My prowess extends across a myriad of technologies, encompassing the likes of React, Vue, Node.js, Golang, C++, Java, Python, Django, jQuery, Ubuntu, Docker, Kubernetes, and the avant-garde of AI. This assemblage of knowledge and skill bespeaks a comprehensive mastery, enabling the orchestration and delivery of innovative solutions within the vast expanse of the technological landscape.

I have 5 years of experience in web development field.


  • 🔭 I’m currently working on Navycut, the fullstack web framework with all the Flask battries included.
  • 🌱 I’m currently learning NextJs.
  • 👯 I’m looking to collaborate on Python open source projects.
  • 🤔 I’m looking for contributors for my open source projects.
  • 💬 Ask me about the Blockchain Technology.
  • 📫 How to reach me: [email protected]


--------------------------------------------------
⚡ GitHub Stats Eran's GitHub Stats
⚡ Most Used Languages Mark's GitHub Top Languages

Talk with me, I am kinda awesome:

github dev linkedin instagram twitter

flask-mailing's People

Contributors

agramfort avatar ahmetkurukose avatar charlestwood avatar imgbotapp avatar marktennyson avatar snyk-bot avatar sriram-bb63 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

flask-mailing's Issues

Error when running on Python 3.11

Getting an error about a duplicate class with one of the modules used in this library.

Sep 21 07:03:38 flaskweb[3047]: from flask_mailing import Mail
Sep 21 07:03:38 flaskweb[3047]: File "/usr/local/lib/python3.11/dist-packages/flask_mailing/init.py", line 88, in
Sep 21 07:03:38 flaskweb[3047]: from . import utils
Sep 21 07:03:38 flaskweb[3047]: File "/usr/local/lib/python3.11/dist-packages/flask_mailing/utils/init.py", line 1, in
Sep 21 07:03:38 flaskweb[3047]: from .email_check import DefaultChecker, WhoIsXmlApi
Sep 21 07:03:38 flaskweb[3047]: File "/usr/local/lib/python3.11/dist-packages/flask_mailing/utils/email_check.py", line 5, in
Sep 21 07:03:38 flaskweb[3047]: import aioredis
Sep 21 07:03:38 flaskweb[3047]: File "/usr/local/lib/python3.11/dist-packages/aioredis/init.py", line 1, in
Sep 21 07:03:38 flaskweb[3047]: from aioredis.client import Redis, StrictRedis
Sep 21 07:03:38 flaskweb[3047]: File "/usr/local/lib/python3.11/dist-packages/aioredis/client.py", line 32, in
Sep 21 07:03:38 flaskweb[3047]: from aioredis.connection import (
Sep 21 07:03:38 flaskweb[3047]: File "/usr/local/lib/python3.11/dist-packages/aioredis/connection.py", line 33, in
Sep 21 07:03:38 flaskweb[3047]: from .exceptions import (
Sep 21 07:03:38 flaskweb[3047]: File "/usr/local/lib/python3.11/dist-packages/aioredis/exceptions.py", line 14, in
Sep 21 07:03:38 flaskweb[3047]: class TimeoutError(asyncio.TimeoutError, builtins.TimeoutError, RedisError):
Sep 21 07:03:38 flaskweb[3047]: TypeError: duplicate base class TimeoutError

sync possible ?

is there any way to NOT use async ?

whitout async I get:

RuntimeWarning: coroutine 'Mail.send_message' was never awaited mailer.send_message(msg)

using async is fine, no errors, the mail goes trough,
but everything else in my app is sync, and I don't want to fall in "what color is your function ?"

MAIL_FROM config value not documented

The following settings worked for Flask-Mail:

MAIL_SERVER = 'smtp.mailtrap.io'
MAIL_PORT = 2525
MAIL_USE_SSL = False
MAIL_USE_TLS = True
MAIL_USERNAME = 'xxxxxxxx'
MAIL_PASSWORD = 'xxxxxxxx'
MAIL_DEFAULT_SENDER = '[email protected]'

However in Flask-Mailing. the app has error:

Traceback (most recent call last):
  File "/usr/local/bin/flask", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 990, in main
    cli.main(args=sys.argv[1:])
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 596, in main
    return super().main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 845, in run_command
    app = DispatchingApp(info.load_app, use_eager_loading=eager_loading)
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 321, in __init__
    self._load_unlocked()
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 346, in _load_unlocked
    self._app = rv = self.loader()
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 402, in load_app
    app = locate_app(self, import_name, name)
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 273, in locate_app
    return find_best_app(script_info, module)
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 68, in find_best_app
    app = call_factory(script_info, app_factory)
  File "/usr/local/lib/python3.8/site-packages/flask/cli.py", line 119, in call_factory
    return app_factory(*args, **kwargs)
  File "/usr/src/app/flask_skm/__init__.py", line 122, in create_app
    mail.init_app(app)
  File "/usr/local/lib/python3.8/site-packages/flask_mailing/mail.py", line 63, in init_app
    self.config = ConnectionConfig(
  File "pydantic/env_settings.py", line 36, in pydantic.env_settings.BaseSettings.__init__
  File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for ConnectionConfig
MAIL_FROM
  value is not a valid email address (type=value_error.email)

MAIL_FROM is set here:

MAIL_FROM = app.config.get("MAIL_FROM", app.config.get("MAIL_USERNAME")),

and perhaps would be better as

     MAIL_FROM = app.config.get("MAIL_FROM", app.config.get("MAIL_DEFAULT_SENDER")),

(or add MAIL_FROM in the "basic_demo"/documentation.

How do I change the sender?

Hey,
how can I change the current sender? I can set a DEFAULT_SENDER and a SENDER during plugin initialization (can anyone explain the difference? But that’s another topic…). But how do I change the sender for a specific message? The message schema doesn't have such a key – but maybe I do miss something?

Best
Pascua

Cannot leave MAIL_USERNAME and MAIL_PASSWORD unset

Hello,

It is very common that you don't need to authenticate to your mail server when using a smart/relay host setup.
However, when I try to leave them unset I get the following error.

MAIL_USERNAME
none is not an allowed value (type=type_error.none.not_allowed)
MAIL_PASSWORD
none is not an allowed value (type=type_error.none.not_allowed)

setup.py missing httpx dependency

httpx==0.18.2 is in requirements.txt but not in setup.py - therefore have issue when installing via pip.

Looks like it was present in 8e93e9 , but removed in 65fb04b

What happened

pip install Flask-Mailing==0.0.4
>>> from flask_mailing import Message
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-7d6b88669445> in <module>
----> 1 from flask_mailing import Message

~/miniconda3/envs/flask-testing/lib/python3.8/site-packages/flask_mailing/__init__.py in <module>
      2 from .config import  ConnectionConfig
      3 from .schemas import Message, MultipartSubtypeEnum
----> 4 from . import utils
      5 
      6 

~/miniconda3/envs/flask-testing/lib/python3.8/site-packages/flask_mailing/utils/__init__.py in <module>
----> 1 from .email_check import DefaultChecker, WhoIsXmlApi
      2 
      3 
      4 __all__ = ["DefaultChecker", "WhoIsXmlApi"]

~/miniconda3/envs/flask-testing/lib/python3.8/site-packages/flask_mailing/utils/email_check.py in <module>
      1 import dns.resolver
      2 import dns.exception
----> 3 import httpx
      4 import inspect
      5 import aioredis

ModuleNotFoundError: No module named 'httpx'

Work around

Install httpx manually

pip install httpx>=0.18.2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.