Git Product home page Git Product logo

mail-n-message's Introduction

Mail-N-Message API (mnm-api)

Mail-N-message API is REST API using which someone can schedule tasks to send mail and sms through computer programs. The API makes use of way2sms API to send text messages and Flask_mail module to send emails. The scheduled mails and messages will be sent to the given email ids and mobile numbers respectively at the specified date and time. The scheduling has been done using APScheduler module in python and API has been created using Flask.

The API code is available in app.py.

Usage

import requests, json

request = {
    
    'datetime': {
        'year': 2019 #int,
        'month': 11 #int,
        'day': 29 #int,
        'hour': 19 #int - 24 hour format,
        'minute': 12 #int,
        'second': 0 #int,
    },
    
    'message': 'Hello', #str
    
    'mail': {
        'to': ['[email protected]', '[email protected]'], # list of strings
        'from': '[email protected]', #str
        'subject': 'test mail', #str
    },
    
    'sms': {
        'to': '<recipient mobile number with country code eg: +911234567890>', #str
        'from': '<sender mobile number with country code eg: +911234567890>', #str
        'apikey': '<your-way2sms-apikey>', #str
        'secret': '<your-way2sms-secret>' #str
    }
}

value = 'both'
# value = 'sms' <to only send sms. need not include mail details in request> 
# value = 'mail' <to only send mails. need not include sms details in request>
# value = 'both' <to send both mail and sms. both mail and sms details should be included>

api_url = f'https://mnm-api-v1.herokuapp.com/v1/{value}'
r = requests.post(api_url, data = json.dumps(request), headers = {'Content-Type': 'application/json'})
print(r.status_code)
print(r.json())

Credits

Created and Developed by: Gagan Talreja
Contact: [email protected]

mail-n-message's People

Contributors

gagantalreja avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

at1693

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.