Upload 6 files
Browse files- .gitattributes +1 -0
- README.md +51 -12
- Vaibhav_Wadhwa.pdf +3 -0
- app.py +34 -0
- email_sender.py +47 -0
- requirements.txt +5 -0
- utils.py +99 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
Vaibhav_Wadhwa.pdf filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,12 +1,51 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Streamlit Email App
|
| 2 |
+
|
| 3 |
+
This project is a Streamlit web application that allows users to send emails with attachments. It provides a user-friendly interface for entering recipient details, email subject, and body text.
|
| 4 |
+
|
| 5 |
+
## Project Structure
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
streamlit-email-app
|
| 9 |
+
├── src
|
| 10 |
+
│ ├── app.py # Main entry point of the Streamlit application
|
| 11 |
+
│ ├── email_sender.py # Contains the email sending functionality
|
| 12 |
+
│ └── utils.py # Utility functions for validation and formatting
|
| 13 |
+
├── requirements.txt # Lists the dependencies required for the project
|
| 14 |
+
└── README.md # Documentation for the project
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## Setup Instructions
|
| 18 |
+
|
| 19 |
+
1. **Clone the repository**:
|
| 20 |
+
```
|
| 21 |
+
git clone <repository-url>
|
| 22 |
+
cd streamlit-email-app
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
2. **Install the required packages**:
|
| 26 |
+
Make sure you have Python installed. Then, run:
|
| 27 |
+
```
|
| 28 |
+
pip install -r requirements.txt
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
## Usage Guidelines
|
| 32 |
+
|
| 33 |
+
1. **Run the application**:
|
| 34 |
+
Navigate to the `src` directory and run:
|
| 35 |
+
```
|
| 36 |
+
streamlit run app.py
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
2. **Using the application**:
|
| 40 |
+
- Enter the recipient's email address.
|
| 41 |
+
- Fill in the subject and body of the email.
|
| 42 |
+
- Optionally, attach a file.
|
| 43 |
+
- Click the "Send Email" button to send the email.
|
| 44 |
+
|
| 45 |
+
## Contributing
|
| 46 |
+
|
| 47 |
+
Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.
|
| 48 |
+
|
| 49 |
+
## License
|
| 50 |
+
|
| 51 |
+
This project is licensed under the MIT License. See the LICENSE file for more details.
|
Vaibhav_Wadhwa.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b230b4493a3b86ec8f40b59c6d3ec73318c3ad636a21e76eb3746b730ea0dabf
|
| 3 |
+
size 154366
|
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from email_sender import send_email
|
| 3 |
+
import utils
|
| 4 |
+
|
| 5 |
+
def main():
|
| 6 |
+
st.title("Email Sending Application")
|
| 7 |
+
|
| 8 |
+
with st.form(key='email_form'):
|
| 9 |
+
Linkedin = st.text_area("Linkedin Profile")
|
| 10 |
+
# recipient_email = st.text_input("Recipient's Email Address")
|
| 11 |
+
# email_subject = st.text_input("Email Subject")
|
| 12 |
+
# email_body = st.text_area("Email Body")
|
| 13 |
+
#attachment = st.file_uploader("Upload Attachment", type=["pdf", "docx", "txt"])
|
| 14 |
+
|
| 15 |
+
submit_button = st.form_submit_button("Send Email")
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
if submit_button:
|
| 20 |
+
text,email=extract_text_and_emails_from_linkedin(url)
|
| 21 |
+
|
| 22 |
+
recipient_email = email
|
| 23 |
+
email_subject = utils.Subject(text)
|
| 24 |
+
email_body = utils.Body(text)
|
| 25 |
+
attachment = 'Vaibhav_Wadhwa.pdf'
|
| 26 |
+
send_email(recipient_email, email_subject, email_body, attachment)
|
| 27 |
+
st.success(f"Email sent successfully{email}!")
|
| 28 |
+
else:
|
| 29 |
+
st.error("Please fill in all fields.")
|
| 30 |
+
return
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
if __name__ == "__main__":
|
| 34 |
+
main()
|
email_sender.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import utils
|
| 2 |
+
from utils import Body
|
| 3 |
+
body=body=f'''Respected Ma'am/Sir,
|
| 4 |
+
{Body(text)}
|
| 5 |
+
Regards,
|
| 6 |
+
Vaibhav Wadhwa
|
| 7 |
+
9311114563
|
| 8 |
+
wadhwa.vaibhav11@gmail.com
|
| 9 |
+
|
| 10 |
+
p.s. I am attaching my resume for your reference.
|
| 11 |
+
ps: this Application is generated by an AI model, please ignore any mistakes.and to checkout my this project visit github.com/Vwadhwa02/LinkedinToEmail'''
|
| 12 |
+
|
| 13 |
+
def send_email(to, subject, body, attachment_path=None):
|
| 14 |
+
import smtplib
|
| 15 |
+
from email.mime.multipart import MIMEMultipart
|
| 16 |
+
from email.mime.text import MIMEText
|
| 17 |
+
from email.mime.base import MIMEBase
|
| 18 |
+
from email import encoders
|
| 19 |
+
import os
|
| 20 |
+
|
| 21 |
+
# Email configurations
|
| 22 |
+
from_email = "03117711721_iot@vips.edu" # Replace with your email
|
| 23 |
+
password = "ehdj jdgo awjc fcko" # Replace with your email password
|
| 24 |
+
smtp_server = "smtp.gmail.com" # Replace with your SMTP server
|
| 25 |
+
smtp_port = 587 # Replace with your SMTP port
|
| 26 |
+
|
| 27 |
+
# Create the email
|
| 28 |
+
msg = MIMEMultipart()
|
| 29 |
+
msg["From"] = from_email
|
| 30 |
+
msg["To"] = to
|
| 31 |
+
msg["Subject"] = subject
|
| 32 |
+
msg.attach(MIMEText(body, "plain"))
|
| 33 |
+
|
| 34 |
+
# Attach the file
|
| 35 |
+
if attachment_path:
|
| 36 |
+
attachment = open(attachment_path, "rb")
|
| 37 |
+
part = MIMEBase("application", "octet-stream")
|
| 38 |
+
part.set_payload(attachment.read())
|
| 39 |
+
encoders.encode_base64(part)
|
| 40 |
+
part.add_header("Content-Disposition", f"attachment; filename={os.path.basename(attachment_path)}")
|
| 41 |
+
msg.attach(part)
|
| 42 |
+
|
| 43 |
+
# Send the email
|
| 44 |
+
with smtplib.SMTP(smtp_server, smtp_port) as server:
|
| 45 |
+
server.starttls()
|
| 46 |
+
server.login(from_email, password)
|
| 47 |
+
server.sendmail(from_email, to, msg.as_string())
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
smtplib
|
| 3 |
+
email
|
| 4 |
+
pandas
|
| 5 |
+
numpy
|
utils.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import smtplib
|
| 2 |
+
from email.mime.multipart import MIMEMultipart
|
| 3 |
+
from email.mime.text import MIMEText
|
| 4 |
+
from email.mime.base import MIMEBase
|
| 5 |
+
from email import encoders
|
| 6 |
+
import os
|
| 7 |
+
import pandas as pd
|
| 8 |
+
import smtplib
|
| 9 |
+
from email.mime.multipart import MIMEMultipart
|
| 10 |
+
from email.mime.text import MIMEText
|
| 11 |
+
from email.mime.base import MIMEBase
|
| 12 |
+
from email import encoders
|
| 13 |
+
import time
|
| 14 |
+
# import psswrd
|
| 15 |
+
import groq
|
| 16 |
+
import os
|
| 17 |
+
import re
|
| 18 |
+
import requests
|
| 19 |
+
from bs4 import BeautifulSoup
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 23 |
+
Groq = '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'
|
| 24 |
+
client = groq.Client(api_key=Groq)
|
| 25 |
+
from_email = "03117711721_iot@vips.edu"
|
| 26 |
+
password ="ehdj jdgo awjc fcko"
|
| 27 |
+
server = smtplib.SMTP("smtp.gmail.com", 587)
|
| 28 |
+
server.starttls()
|
| 29 |
+
server.login(from_email, password)
|
| 30 |
+
|
| 31 |
+
def is_valid_email(email):
|
| 32 |
+
import re
|
| 33 |
+
email_regex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
|
| 34 |
+
return re.match(email_regex, email) is not None
|
| 35 |
+
|
| 36 |
+
def format_email_body(text):
|
| 37 |
+
return f"Dear Recipient,\n\n{text}\n\nBest Regards,\nVaibhav Wadhwa"
|
| 38 |
+
|
| 39 |
+
def Body(text):
|
| 40 |
+
f=str()
|
| 41 |
+
op = client.chat.completions.create(
|
| 42 |
+
model="llama-3.3-70b-versatile",
|
| 43 |
+
messages=[{
|
| 44 |
+
"role": "system",
|
| 45 |
+
"content": f"{res}"
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"role": "user",
|
| 49 |
+
"content": f"Write a mail to hr based on {text} research about there company and show them how I can be an asset to their company and talk about my accomplishments and experience. Just the body no Preamble."
|
| 50 |
+
}],
|
| 51 |
+
temperature=0.83,
|
| 52 |
+
max_completion_tokens=730,
|
| 53 |
+
top_p=1,
|
| 54 |
+
stream=True,
|
| 55 |
+
stop=None
|
| 56 |
+
)
|
| 57 |
+
for chunk in op:
|
| 58 |
+
f+=f'{chunk.choices[0].delta.content}'
|
| 59 |
+
|
| 60 |
+
return f
|
| 61 |
+
|
| 62 |
+
def Subject(text):
|
| 63 |
+
f=str()
|
| 64 |
+
op = client.chat.completions.create(
|
| 65 |
+
model="llama-3.3-70b-versatile",
|
| 66 |
+
messages=[{
|
| 67 |
+
"role": "system",
|
| 68 |
+
"content": f"{res}"
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"role": "user",
|
| 72 |
+
"content": f"Write a mail to hr based on {text} research about there company and show them how I can be an asset to their company and talk about my accomplishments and experience. and use my given data Just the Subject no Preamble."
|
| 73 |
+
}],
|
| 74 |
+
temperature=1.1,
|
| 75 |
+
max_completion_tokens=730,
|
| 76 |
+
top_p=1,
|
| 77 |
+
stream=True,
|
| 78 |
+
stop=None
|
| 79 |
+
)
|
| 80 |
+
for chunk in op:
|
| 81 |
+
f+=f'{chunk.choices[0].delta.content}'
|
| 82 |
+
|
| 83 |
+
return f
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def extract_text_and_emails_from_linkedin(url):
|
| 87 |
+
headers = {
|
| 88 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
|
| 89 |
+
}
|
| 90 |
+
response = requests.get(url, headers=headers)
|
| 91 |
+
if response.status_code != 200:
|
| 92 |
+
return "Failed to fetch the post", []
|
| 93 |
+
soup = BeautifulSoup(response.text, "html.parser")
|
| 94 |
+
# Extract text content (modify the selector based on LinkedIn’s structure)
|
| 95 |
+
text = ' '.join([p.text for p in soup.find_all('p')])
|
| 96 |
+
# Extract emails using regex
|
| 97 |
+
email_pattern = r'[a-zA-Z0-9+._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
|
| 98 |
+
emails = re.findall(email_pattern, text)
|
| 99 |
+
return text, emails
|