INNER CODE UNIT · Python
mail_alert
tejaslinge/Alpaca-ROC-Trading-Bot · main.py:205
def mail_alert(mail_content, sleep_time):
# The mail addresses and password
sender_address = 'sender_address'
sender_pass = 'sender_password'
receiver_address = 'receiver_address'
# Setup MIME
message = MIMEMultipart()
message['From'] = 'Trading Bot'
message['To'] = receiver_address
message['Subject'] = 'HFT Second-Bot'
# The body and the attachments for the mail
message.attach(MIMEText(mail_content, 'plain'))
# Create SMTP session for sending the mail
session = smtplib.SMTP('smtp.gmail.com', 587) # use gmail with port
session.starttls() # enable security