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
Exemple #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
Exemple #3
0
	def test_send(self):
		from frappe.email import sendmail
		sendmail('*****@*****.**', subject='Test Mail', msg="Test Content")
Exemple #4
0
 def test_send(self):
     from frappe.email import sendmail
     sendmail('*****@*****.**', subject='Test Mail', msg="Test Content")