Sindbad~EG File Manager

Current Path : /home/numerotech/tricon2023-videos.tnoa.info/conf_video_app/core/library/
Upload File :
Current File : //home/numerotech/tricon2023-videos.tnoa.info/conf_video_app/core/library/email.py

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



class EMAIL:
	
# 	def sendMail(subject,html,to):
# 		MANDRILL_API_KEY='3rql7lHFpPcoHnNAWYQTFQ'
# 		# MANDRILL_API_KEY='vjnWv_w_ZPRriVUYOgCpPw'
# 		mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)
# 		message = { 'from_email': 'support@numerotec.com',
# 		'from_name': 'TRICON 2023 - Scientific Session Recordings',
# 		'to': [{
# 				'email': to,
# 				'name': to,
# 				'type': 'to'
# 				}],
# 		'subject': subject,
# 		'html': html
# 		}
# 		result = mandrill_client.messages.send(message = message)
# 		return ('success')
	
	def sendMail(subject,html,to):
		from_mail_name   =  "TRICON 2023 - Scientific Session Recordings"
		from_mail_id     = "support@numerotec.com"
		secret_key       = "key-e13725db7c3a95b679911c038b490db1"
		url      = 'https://api.mailgun.net/v3/mg.numerotec.com/messages'
		auth     = ('api',secret_key)
		data     = {
		'from'   : from_mail_name+'<'+from_mail_id+'>',
		'to'     : to,
		'subject': subject,
		'html'   : html
		}
		data['h:Reply-To']= from_mail_id
		res  = requests.post(url, auth=auth, data=data)
		return "mail sent successful." 
	
		
	# def sendMail(subject,html,to):
		
	#     # MANDRILL_API_KEY='XEs1ytJQpEwaZSq25YgB4Q' # IP ADDRESS ENABLED
	#     # MANDRILL_API_KEY='3rql7lHFpPcoHnNAWYQTFQ' # IP ADDRESS not ENABLED
	#     # nqYKScJDBACrj8U32dH70w
	#     MANDRILL_API_KEY='nqYKScJDBACrj8U32dH70w' # IP ADDRESS not ENABLED
	#     mandrill_client = mandrill.Mandrill(MANDRILL_API_KEY)

	#     #Test mail id for all  mails
	#     # is_test_mail = AbstractModel().settings_mail('is_test_mail')
	#     # if is_test_mail["setting_value"] != 0 :
	#         # is_test_mail_id = AbstractModel().settings_mail('is_test_mail_id')
	#         # to = is_test_mail_id["setting_value"]
	#     message = {
	#                 'from_email' : ' support@numerotec.com',
	#                 'from_name': 'VRSI 2022 - Scientific Session Recordings',
	#                 'subject' : subject,
	#                 'recipients':to,
	#                 'html': html,
	#                 "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 sendMailInMailGun(subject,html,to,cc=[],bcc=[]):
	#     url  = 'https://api.mailgun.net/v3/numerotech.com/messages'
	#     bcc  = ["tnoabackup@gmail.com"]
	#     auth = ('api', 'key-e13725db7c3a95b679911c038b490db1')
	#     data = {
	#     'from'   : 'TNOA <support@tnoa.info>',
	#     'to'     : to,
	#     'cc'     : cc,
	#     'bcc'    : bcc,
	#     'subject': subject,
	#     'html'   : html
	#     }
	#     data['h:Reply-To']="Support <support@tnoa.info>"  # <------------- HERE!
	#     res  = requests.post(url, auth=auth, data=data)
	#     return "mail sent successful."  


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