-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_mail.py
More file actions
22 lines (18 loc) · 784 Bytes
/
Copy pathsend_mail.py
File metadata and controls
22 lines (18 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import smtplib
from email.mime.text import MIMEText
def send_mail(customer, dealer, rating, comments):
port = 2525
smtp_server = 'smtp.mailtrap.io'
login = 'da7a07c8b9628d'
password = '37e43830c3b32c'
message = f"<h3>New Feedback Submission</h3><ul><li>Customer: {customer}</li><li>Dealer: {dealer}</li><li>Rating: {rating}</li><li>Comments: {comments}</li></ul>"
sender_email = 'email1@example.com'
receiver_email = 'email2@example.com'
msg = MIMEText(message, 'html')
msg['Subject'] = 'Lexus Feedback'
msg['From'] = sender_email
msg['To'] = receiver_email
# Send email
with smtplib.SMTP(smtp_server, port) as server:
server.login(login, password)
server.sendmail(sender_email, receiver_email, msg.as_string())