This is a simple python script which will fetch logs from git and send it as a mail. All the configurations are defined in config.py
- subprocess
- jinja2
- smtplib
- datetime
- MIMEMultipart
- MIMEText
For this mail to work perfectly. The commit message should have specific format. The format is commit message pipe (|) link pipe status in caps. Here
- commit message is the actual message you want to add
- link is the link to the issue or feature which you were trying to resolve or implement
- status is the current status of the todo (INPROGRESS | COMPLETED)
commit message | link | STATUS
python sendMail.py
You can add multiple repos. This field will accept array of dictionaries with the following format
repos = [{'name': 'repo_name', 'path':'path_to_folder_repo'}]
###devs
This field should the array of name of developers. This should be same as the git global name
devs = ['User']
###log_interval
This field defines the interval of log that should be extracted. It is mentioned in weeks
log_interval = 1 # number of weeks log required to show
This field accepts a dictionary as input where you can provice name of the organization and url of the logo of the organization. It will be used by the email template to display it on top
company_detail={'name':'name_of_the_company', 'logo':'url_to_the_location'}
This field defines the recipeints of the mail. It accepts an array of dictionary with name of the recipient and email address
recipients = [{'name': 'name_of_the_recipient', 'email':'email_of_the_recipient'}]
This field will hold all the credentials of sender email. It is a dictionary where you can add subject of the mail, from email id, password and smtp server detials
sender={'Subject':'subject_of_the_mail','From':'from_email_id','smtp':'smtp:port','password': "password"}
This is name of the template file
template_file='email_temp.jinja'
This is the location of the template file
template_folder='/home/ubuntu/script/emailSend'
This script uses subprocess.check_output
with argument shell = True
, which is discouraged due to security reasons and could be a threat if used without proper knowledge. Read more about that [here] (https://docs.python.org/2/library/subprocess.html#frequently-used-arguments)