Add custom text message after break line

106 views Asked by At

The below code snippet sends email with status. If I want to add another line break with text as Sent from Scheduler. What could be the possible way ?

def send_email(status,message):
    date = str(datetime.now().date())[-5:].replace('-', '/')
    yag.send(to=TO_EMAIL,subject="{} Rebuild Code: {}".format(date, status),contents=message)
    logging.info("Mail Sent!")

Thanks!

1

There are 1 answers

3
yogkm On BEST ANSWER

Please try this updated code.

Update:

def send_email(status,message):
    date = str(datetime.now().date())[-5:].replace('-', '/')
    message = "{}\n{}".format(message, 'Sent from Scheduler'
    yag.send(to=TO_EMAIL,subject="{} Rebuild Code: {}".format(date, status),contents=message))
    logging.info("Mail Sent!")

Here, instead of just returning the message, it can be updated as "{}\n{}".format(message, 'Sent from Scheduler') \n is the single line break. If you want multiple line breaks you can use \n\n.