0

I wanted fetch issues from from project in jira using jira api and send it to groupemail via jira automatically. I am using PYTHON. I have tried fetching data using jira api. But am stuck sending email . Could someone please help here. How can we do it either SMTP or any API.?

Ramya
  • 1
  • Welcome to SO. Please take time to read https://stackoverflow.com/help/how-to-ask and edit your question. – Bussller Jun 15 '20 at 05:59

1 Answers1

0

You can use the smtplib module in Python to send the email messages. Make sure you do have the SMTP host & SMTP port values for your account with you.

The below is a simple script to send email from your account.

import os
import smtplib
from email.message import EmailMessage

RECEIVER_EMAIL_LIST = [] #list of recipients
SMTP_SERVER = os.environ['smtp_server']
SMTP_PORT = os.environ['smtp_port']
SENDER_EMAIL = os.environ['my_email']
SENDER_PASSWORD = os.environ['my_email_password']

server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
server.starttls()
server.login(SENDER_EMAIL, SENDER_PASSWORD)

message = EmailMessage()

email_body_content = 'Your content here'

message.set_content(email_body_content)
message['Subject'] = 'Subject goes here'
message['From'] = SENDER_EMAIL
message['To'] = ', '.join(RECEIVER_EMAIL_LIST)

server.send_message(message)

For documentation, click here.

shreyaskar
  • 375
  • 1
  • 3
  • 14