Ejemplo n.º 1
0
    def send_email(self):
        """
			Sends the link to backup file located at erpnext/backups
		"""
        from frappe.email import sendmail, get_system_managers

        recipient_list = get_system_managers()
        db_backup_url = get_url(
            os.path.join('backups', os.path.basename(self.backup_path_db)))
        files_backup_url = get_url(
            os.path.join('backups', os.path.basename(self.backup_path_files)))

        msg = """Hello,

Your backups are ready to be downloaded.

1. [Click here to download the database backup](%(db_backup_url)s)
2. [Click here to download the files backup](%(files_backup_url)s)

This link will be valid for 24 hours. A new backup will be available for
download only after 24 hours.""" % {
            "db_backup_url": db_backup_url,
            "files_backup_url": files_backup_url
        }

        datetime_str = datetime.fromtimestamp(
            os.stat(self.backup_path_db).st_ctime)
        subject = datetime_str.strftime(
            "%d/%m/%Y %H:%M:%S") + """ - Backup ready to be downloaded"""

        sendmail(recipients=recipient_list, msg=msg, subject=subject)
        return recipient_list
Ejemplo n.º 2
0
	def send_email(self):
		"""
			Sends the link to backup file located at erpnext/backups
		"""
		from frappe.email import sendmail, get_system_managers

		recipient_list = get_system_managers()
		db_backup_url = get_url(os.path.join('backups', os.path.basename(self.backup_path_db)))
		files_backup_url = get_url(os.path.join('backups', os.path.basename(self.backup_path_files)))

		msg = """Hello,

Your backups are ready to be downloaded.

1. [Click here to download the database backup](%(db_backup_url)s)
2. [Click here to download the files backup](%(files_backup_url)s)

This link will be valid for 24 hours. A new backup will be available for
download only after 24 hours.""" % {
			"db_backup_url": db_backup_url,
			"files_backup_url": files_backup_url
		}

		datetime_str = datetime.fromtimestamp(os.stat(self.backup_path_db).st_ctime)
		subject = datetime_str.strftime("%d/%m/%Y %H:%M:%S") + """ - Backup ready to be downloaded"""

		sendmail(recipients=recipient_list, msg=msg, subject=subject)
		return recipient_list
Ejemplo n.º 3
0
def send_billing_reminder(confirmation_url):
	system_manager = get_system_managers()[0]
	usage_info = get_usage_info()
	data = {
		'site': frappe.local.site,
		'full_name': frappe.db.get_value('User', system_manager, 'concat(ifnull(first_name, ""), ifnull(last_name, ""))'),
		'support_email': '*****@*****.**',
		'confirmation_url': confirmation_url,
		'expires_on': usage_info.expires_on
	}

	stats = frappe.render_template('erpnext_shopify/templates/emails/billing.md', data, is_path=True)
	frappe.sendmail(recipients=[system_manager], subject='Your Shopify-ERPNext subscription is about to expire', message=markdown(stats))
Ejemplo n.º 4
0
def send_billing_reminder(confirmation_url):
    system_manager = get_system_managers()[0]
    usage_info = get_usage_info()
    data = {
        'site':
        frappe.local.site,
        'full_name':
        frappe.db.get_value(
            'User', system_manager,
            'concat(ifnull(first_name, ""), ifnull(last_name, ""))'),
        'support_email':
        '*****@*****.**',
        'confirmation_url':
        confirmation_url,
        'expires_on':
        usage_info.expires_on
    }

    stats = frappe.render_template(
        'erpnext_shopify/templates/emails/billing.md', data, is_path=True)
    frappe.sendmail(
        recipients=[system_manager],
        subject='Your Shopify-ERPNext subscription is about to expire',
        message=markdown(stats))