Sindbad~EG File Manager

Current Path : /home/numerotech/aiosgreedingsmail.urbanedge.co.in/aios_birthday/core/library/
Upload File :
Current File : //home/numerotech/aiosgreedingsmail.urbanedge.co.in/aios_birthday/core/library/email.py

from flask import request, url_for,flash
from core import app
from flask import url_for
from datetime import datetime, date, time, timedelta
import requests,mandrill,json

from flask import render_template,Flask, Response

from flask import current_app
from flask_mail import Message




class EMAIL:

	# def _sendMail(app, message):  # target function
    # with app.app_context():
    # mail.send(message)


	def sendMail(subject,html,to):
		# XEs1ytJQpEwaZSq25YgB4Q  Key given by sridhar anna
		# nqYKScJDBACrj8U32dH70w
		MANDRILL_API_KEY='vjnWv_w_ZPRriVUYOgCpPw'
		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)

		message = {'subject' : subject, 'recipients':to,'from_name': 'Prof. (Dr.) Namrata Sharma - Chairperson, Scientific Committee',
        'html': html, 'from_email' : 'support@aios-online.com', 
        'cc' : 'sai@numerotec.com', 'Reply-To' : 'support@aios-online.com',
        "headers" :{"Reply-To": "support@aios-online.com"} ,'to' : [{'email':to,'name':to,'type':'to'},{'email':'aiosbackup@gmail.com','name':to,'type':'cc'}] }
		# message = {'subject' : subject, 'recipients':to,'from_name': 'All India Ophthalmological Society',
  #       'html': html, 'from_email' : 'support@aios-online.com', 
  #       'cc' : 'sai@numerotec.com', 'Reply-To' : 'support@aios-online.com',
  #       "headers" :{"Reply-To": "support@aios-online.com"} ,'to' : [{'email':to,'name':to,'type':'to'},
  #       {'email':'sai@numerotec.com','name':to,'type':'cc'}] }

		result = mandrill_client.messages.send(message = message,send_async=True)		
		return ('success')


	def sendMailToOfficeBearer(subject,user_name,email,namelist):
		# 7L0tswCIdGHr6oKi6IrW8A
		# XEs1ytJQpEwaZSq25YgB4Q key given by sridhar anna

		MANDRILL_API_KEY='vjnWv_w_ZPRriVUYOgCpPw'
		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
		variable = "Good morning  Dr." + user_name + " , Today Birthday Name list: " + namelist
		message = { 'from_email': 'support@aios-online.com',
		'from_name': 'Dr.Namrata Sharma,  Hon. Gen. Secretary, AIOS ',
		'to': [{
				'email': email,
				'name': user_name,
				'type': 'to'
				},
				{
				'email': "aiosbackup@gmail.com",
				'name': user_name,
				'type': 'cc'
				}],
		'subject': "Dr."+user_name + " , Today Birthday Name list ",
		'html': variable,
		"headers": {
			"Reply-To": "support@aios-online.com"
		},

		}

		result = mandrill_client.messages.send(message = message)
		return ('success')


	def sendMailWorkingBackup(subject,html,to):
		# XEs1ytJQpEwaZSq25YgB4Q  Key given by sridhar anna
		# nqYKScJDBACrj8U32dH70w
		MANDRILL_API_KEY='nqYKScJDBACrj8U32dH70w'
		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
		message = {'subject' : subject, 'recipients':to,'from_name': 'All India Ophthalmological Society',
        'html': html, 'from_email' : 'support@numerotec.com', 
        'cc' : 'ganesan@numerotec.com', 'Reply-To' : 'support@aios-online.com',
        "headers" :{"Reply-To": "support@aios-online.com"} ,'to' : [{'email':to,'name':to,'type':'to'},
        {'email':'sai@numerotec.com','name':to,'type':'cc'},{'email':'ganesan@numerotec.com','name':to,'type':'cc'}] }


		result = mandrill_client.messages.send(message = message,send_async=True)		
		return ('success')	


	

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists