Sindbad~EG File Manager
from flask import request, url_for,flash, render_template,redirect
from core import app
from flask import url_for
from datetime import datetime, date, time, timedelta
import requests,mandrill,json
from core.library.helper import Helper
from .. import Cryptography,Auth,Helper,RouteGroup
class Mailgun:
def sendMail(subject,html,to,mailData,conf):
if conf:
bcc_mails = conf['e_backup_emails']
from_mail_name = conf['conf_title']
from_mail_id = conf['e_from_email']
reply_mail_id = conf['e_reply_to']
if mailData:
if mailData['bcc_mails'] is not None:
bcc_mails = mailData['bcc_mails']
if mailData['from_mail_name'] is not None :
from_mail_name = mailData['from_mail_name']
if mailData['from_mail_id'] is not None :
from_mail_id = mailData['from_mail_id']
if mailData['reply_mail_id'] is not None :
reply_mail_id = mailData['reply_mail_id']
# for sending backup mails
if int(mailData['is_send_backup'])==1:
bcc = [bcc_mails]
else:
bcc = []
else:
bcc = []
# return "mail sent successful"
cc = []
# bcc = [bcc_mails]
url = 'https://api.mailgun.net/v3/'+conf['domain']+'/messages'
auth = ('api',conf['secret_key'])
data = {
'from' : from_mail_name+'<'+from_mail_id+'>',
'to' : to,
'cc' : cc,
'bcc' : bcc,
'subject': subject,
'html' : html
}
data['h:Reply-To']= reply_mail_id
res = requests.post(url, auth=auth, data=data)
return "mail sent successful."
else:
return redirect (url_for('user.Home'))
def sendMail_v2(subject,html,to_mail,bcc_mail,mailData,conf):
if conf:
bcc_mails = conf['e_backup_emails']
from_mail_name = "NumeroTec Support"
from_mail_id = conf['e_from_email']
reply_mail_id = conf['e_reply_to']
cc = []
url = 'https://api.mailgun.net/v3/'+conf['domain']+'/messages'
auth = ('api',conf['secret_key'])
data = {
'from' : from_mail_name+'<'+from_mail_id+'>',
'to' : to_mail,
'cc' : cc,
'bcc' : bcc_mail,
'subject': subject,
'html' : html
}
data['h:Reply-To']= reply_mail_id
res = requests.post(url, auth=auth, data=data)
return "mail sent successful."
else:
return redirect (url_for('user.Home'))
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists