Sindbad~EG File Manager

Current Path : /home/numerotech/imagepoll.numerotech.com/common_imagepoll_v1/core/library/
Upload File :
Current File : //home/numerotech/imagepoll.numerotech.com/common_imagepoll_v1/core/library/email.py

from flask import request, url_for,flash, render_template,session
from core import app
from flask import url_for
# from core.model.AbstractModel import AbstractModel
from datetime import datetime, date, time, timedelta
import requests,mandrill,json
from .. import Cryptography,Auth
from core.library.Mandrill import Mandrill
from core.library.Mailgun import Mailgun


class EMAIL:
    def sendMail(subject,html,to,mailData,societyData):
        # print("societyData",societyData)
        # societyData = Auth.getSociety(society_id)
        if societyData :
            if societyData['driver'] == 'mailgun':
                # pass
                Mailgun.sendMail(subject,html,to,mailData,societyData)
            elif societyData['driver'] == 'mandrill':
                # pass
                Mandrill.sendMail(subject,html,to,mailData,societyData)
            else:
                return "Please check mail configuration setting"
        else:
            return redirect (url_for('image_poll.home'))

    
# 	def sendMail(subject,html,to,conf):
# 		# to = "ganesan@numerotec.com"  # for test use
# 		# MANDRILL_API_KEY='MAoeFJshVAG4-xTyPpTgUg'
# 		if to:
# 			MANDRILL_API_KEY='XEs1ytJQpEwaZSq25YgB4Q' # IP ADDRESS ENABLED
# 			mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)

# 			message = {'subject' : subject, 'recipients':to,'from_name': conf['conf_title'],
# 			'html': html, 'from_email' : conf['from_email'],
# 			"headers" :{"Reply-To": conf['reply_to']} ,'to' : [{'email':to,'name':to,'type':'to'},{'email':conf['backup_email'],'name':to,'type':'cc'}] }

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

# 		else:
# 			return ('Email Id is Blank')
		
# 	# The below function updated by Ganesan 2022-11-05 13:00:00	
# 	def KcReportMail(subject,html,to):
# 		# MANDRILL_API_KEY='MAoeFJshVAG4-xTyPpTgUg'
# 		MANDRILL_API_KEY='3rql7lHFpPcoHnNAWYQTFQ' # IP ADDRESS ENABLED
# 		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
 
# 		message = {'subject' : subject, 'recipients':to,'from_name': 'Kit counter report',
# 		'html': html, 'from_email' : 'support@numerotec.com',
# 		"headers" :{"Reply-To": "support@numerotec.com"} ,'to' : [{'email':to,'name':to,'type':'to'},{'email':'ganesan@numerotec.com','name':to,'type':'to'}] }
 
# 		result = mandrill_client.messages.send(message = message,send_async=True)
# 		return ('success')

# 	def FcReportMail(subject,html,to):
# 		# MANDRILL_API_KEY='MAoeFJshVAG4-xTyPpTgUg'
# 		MANDRILL_API_KEY='3rql7lHFpPcoHnNAWYQTFQ' # IP ADDRESS ENABLED
# 		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
 
# 		message = {'subject' : subject, 'recipients':to,'from_name': 'Food counter report',
# 		'html': html, 'from_email' : 'support@numerotec.com',
# 		"headers" :{"Reply-To": "support@numerotec.com"} ,'to' : [{'email':to,'name':to,'type':'to'}] }
 
# 		result = mandrill_client.messages.send(message = message,send_async=True)
# 		return ('success')

# 	def sendMail_v1(subject,html,to,mailData,society_id,society=None):
# 		society = society if society else session.get('society',None)
# 		if society :
# 			if society['driver'] == 'mailgun':
# 				# pass
# 				Mailgun.sendMail(subject,html,to,mailData,society_id)
# 			elif society['driver'] == 'mandrill':
# 				# pass
# 				Mandrill.sendMail(subject,html,to,mailData,society_id,society)
# 			else:
# 				return "Please check mail configuration setting"
# 		else:
# 			return redirect (url_for('image_poll.home'))

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