Sindbad~EG File Manager

Current Path : /home/numerotech/mosgreedingsmail.urbanedge.co.in/mos_birthday/core/library/
Upload File :
Current File : //home/numerotech/mosgreedingsmail.urbanedge.co.in/mos_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
# MOS Mail function




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='nqYKScJDBACrj8U32dH70w'
		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
		message = {'subject' : subject, 'recipients':to,'from_name': 'Maharashtra Ophthalmological Society ',
        'html': html, 'from_email' : 'support@moseye.org', 
        'cc' : 'mosbirthdaymailbackup@gmail.com', 'Reply-To' : 'aaheroor@gmail.com',
        "headers" :{"Reply-To": "aaheroor@gmail.com"} ,'to' : [{'email':to,'name':to,'type':'to'},{'email':'mosbirthdaymailbackup@gmail.com','name':to,'type':'cc'}] }

#       secretary2020mos@gmail.com
# 		message = { 'from_email': 'support@numerotec.com',
# 		'from_name': 'MOS Birthday Mail',
# 		'to': [{
# 				'email': to,
# 				'name': to,
# 				'type': 'to'
# 				},
# 				{
# 		         "email":"mosconbackup@gmail.com",
# 		         "name":"MOS Backup",
# 		         "type":"cc"
# 		      }],
# 		'subject': subject,
# 		'html': html
# 		}

		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='nqYKScJDBACrj8U32dH70w'
		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
		variable = "Good morning  Dr." + user_name + " , Today Birthday Name list: " + namelist
		message = { 'from_email': 'support@moseye.org',
		'from_name': 'MOS Birthday Greetings Mail ',
		'to': [{
				'email': email,
				'name': user_name,
				'type': 'to'
				},
				{
				    'email' : 'mosbirthdaymailbackup@gmail.com',
				    'name'  : user_name,
				    'type'  : 'cc'
				}
				],
		'subject': "Dr."+user_name + " , Today Birthday Name list ",
		'html': variable,
		"headers": {
			"Reply-To": email
		},

		}

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


	

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