Esempio n. 1
0
	def get(self, param=None):
	  
		server_details = email_model.get_email_details()
		recepients = email_recepient_model.get_all()
		self.render('settings/email/email.html',
				server_details=server_details,
				recepients=recepients)
Esempio n. 2
0
    def get(self, param=None):

        server_details = email_model.get_email_details()
        recepients = email_recepient_model.get_all()
        self.render('settings/email/email.html',
                    server_details=server_details,
                    recepients=recepients)
Esempio n. 3
0
def send_mail(recepients=None, subject=None, template=None,  template_data=None):
	connection_details = email_model.get_email_details()

	port = int(connection_details['port'])
	security = connection_details['security'] if connection_details['security'] != 'None' else None

	mailer = ThreadedMailer(SMTPMailer(connection_details['address'], port, 
					username = connection_details['username'],
					password = connection_details['password'],
					transport_args = {'security': security},
					log_file = '/var/log/amonone/amonone-mailer.log',
					log_messages=False))


	EMAIL_ROOT = abspath(dirname(__file__))
	TEMPLATES_DIR =  join(EMAIL_ROOT, 'templates')

	env = Environment(loader=FileSystemLoader(TEMPLATES_DIR))
	env.filters['date_local'] = dateformat_local

	template_file = env.get_template("{0}.html".format(template))
	rendered_template = template_file.render(template_data=template_data)

	message = escape.to_unicode(rendered_template)

	subject = escape.to_unicode(subject)

	email_recepients = [x['email'] for x in recepients]

	try: 
		mailer.send_html(connection_details['from_'], email_recepients, subject, message)
	except Exception, e:
		print e
		raise e 
Esempio n. 4
0
	def get(self, param=None):
		errors =  self.session.get('errors',None)
		form_data =  self.session.get('form_data',None)
		server_details = email_model.get_email_details()

		self.delete_session_key('errors')
		self.delete_session_key('form_data')

		self.render('settings/email/update_smtp_details.html',
					server_details=server_details,
					errors=errors,
					form_data=form_data)
Esempio n. 5
0
    def get(self, param=None):
        errors = self.session.get('errors', None)
        form_data = self.session.get('form_data', None)
        server_details = email_model.get_email_details()

        self.delete_session_key('errors')
        self.delete_session_key('form_data')

        self.render('settings/email/update_smtp_details.html',
                    server_details=server_details,
                    errors=errors,
                    form_data=form_data)
Esempio n. 6
0
def send_mail(recepients=None,
              subject=None,
              template=None,
              template_data=None):
    connection_details = email_model.get_email_details()

    port = int(connection_details['port'])
    security = connection_details[
        'security'] if connection_details['security'] != 'None' else None

    mailer = ThreadedMailer(
        SMTPMailer(connection_details['address'],
                   port,
                   username=connection_details['username'],
                   password=connection_details['password'],
                   transport_args={'security': security},
                   log_file='/var/log/amonone/amonone-mailer.log',
                   log_messages=False))

    EMAIL_ROOT = abspath(dirname(__file__))
    TEMPLATES_DIR = join(EMAIL_ROOT, 'templates')

    env = Environment(loader=FileSystemLoader(TEMPLATES_DIR))
    env.filters['date_local'] = dateformat_local

    template_file = env.get_template("{0}.html".format(template))
    rendered_template = template_file.render(template_data=template_data)

    message = escape.to_unicode(rendered_template)

    subject = escape.to_unicode(subject)

    email_recepients = [x['email'] for x in recepients]

    try:
        mailer.send_html(connection_details['from_'], email_recepients,
                         subject, message)
    except Exception, e:
        print e
        raise e