Skip to content

Getting Started

Aniket Sarkar edited this page Jan 14, 2023 · 1 revision

🕹 Guide

After installing the module and setting up your Flask app:

The main classes and packages are Mail Message utils.DefaultChecker utils.WhoIsXmlApi

Available config options

the class has the following attributes

  • MAIL_USERNAME : Username for email, some email hosts separate username from the default sender(AWS).
    • If your service does not provide a username use the sender address for the connection.
  • MAIL_PASSWORD : Password for authentication
  • MAIL_SERVER : SMTP Mail server.
  • MAIL_USE_TLS : For TLS connection
  • MAIL_USE_SSL : For TLS connection
  • MAIL_DEBUG : Debug mode for while sending mails, defaults 0.
  • MAIL_FROM : Sender address
  • MAIL_DEFAULT_SENDER : Sender address
  • MAIL_FROM_NAME : Title for Mail
  • TEMPLATE_FOLDER: If you are using jinja2, specify template folder name
  • SUPPRESS_SEND: To mock sending out mail, defaults 0.
  • USE_CREDENTIALS: Defaults to True. However, it enables users to choose whether or not to log in to their SMTP server.
  • VALIDATE_CERTS: Defaults to True. It enables one to choose whether to verify the mail server's certificate

Mail class

the class has the following attributes and methods

  • send_message : The method has two attributes, message: Message, template_name=None

    • message : where you define message structure for email
    • template_name : if you are using jinja2 consider template_name as well for passing HTML.
  • send_mail : sending emails with message strings and recipients very similar to Django.

    • subject : A String containing the subject of the message.
    • message : A string containing the message body.
    • recipients : A list of strings, each an email address. Each member of the recipients will see the other recipients in the “To:” field of the email message.
    • msgkwargs : the kwargs-based parameters for the Message class.
  • send_mass_mail : To handle mass mailing.

    • datatuple : is a tuple in which each element is in this format:
      (subject, message, recipients)

Message class

the class has the following attributes

  • recipients : List of recipients.
  • attachments : attachments within the mail.
  • subject : subject content of the mail.
  • body : the body of the message.
  • template_body: parameters for the jinja template.
  • template_params: parameters for the jinja template.
  • cc : cc recipients of the mail.
  • bcc : bcc recipients of the mail.
  • reply_to : Reply-To recipients in the mail.
  • charset : charset defaults to utf-8.
  • subtype : subtype of the mail defaults to plain.
  • add_recipient : a method to add additional recipients.
  • attach : a method to add additional attachments.

utils.DefaultChecker class

The default class for checking email from collected public resources. The class makes it possible to use Redis to save data.

  • source : optional source for collected email data.
  • db_provider : switch to Redis

utils.WhoIsXmlApi class

WhoIsXmlApi class provides working with API WhoIsXmlApi This service gives free 1000 requests to check email addresses per month.

  • token : token you can get from this WhoIsXmlApi link
  • email : email for checking
Clone this wiki locally