| import utils |
| from utils import Body |
| body=body=f'''Respected Ma'am/Sir, |
| {Body(text)} |
| Regards, |
| Vaibhav Wadhwa |
| 9311114563 |
| wadhwa.vaibhav11@gmail.com |
| |
| p.s. I am attaching my resume for your reference. |
| ps: this Application is generated by an AI model, please ignore any mistakes.and to checkout my this project visit github.com/Vwadhwa02/LinkedinToEmail''' |
|
|
| def send_email(to, subject, body, attachment_path=None): |
| import smtplib |
| from email.mime.multipart import MIMEMultipart |
| from email.mime.text import MIMEText |
| from email.mime.base import MIMEBase |
| from email import encoders |
| import os |
|
|
| |
| from_email = "03117711721_iot@vips.edu" |
| password = "ehdj jdgo awjc fcko" |
| smtp_server = "smtp.gmail.com" |
| smtp_port = 587 |
|
|
| |
| msg = MIMEMultipart() |
| msg["From"] = from_email |
| msg["To"] = to |
| msg["Subject"] = subject |
| msg.attach(MIMEText(body, "plain")) |
|
|
| |
| if attachment_path: |
| attachment = open(attachment_path, "rb") |
| part = MIMEBase("application", "octet-stream") |
| part.set_payload(attachment.read()) |
| encoders.encode_base64(part) |
| part.add_header("Content-Disposition", f"attachment; filename={os.path.basename(attachment_path)}") |
| msg.attach(part) |
|
|
| |
| with smtplib.SMTP(smtp_server, smtp_port) as server: |
| server.starttls() |
| server.login(from_email, password) |
| server.sendmail(from_email, to, msg.as_string()) |
|
|