-
Notifications
You must be signed in to change notification settings - Fork 21
Ngawa tafe/issue18 #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…d to modular structure.
…sage and send bulk message
@coderatul Please review before i progress further to write tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Modularizes the email bomber script by extracting functionality into dedicated modules and updating the Docker setup.
- Extract SMTP connection, authentication, email construction, and credential management into separate files
- Replace monolithic
emailbomber.py
withemail_bomber()
entrypoint and updatemain.py
- Update Dockerfile to reflect new project structure
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
src/server.py | Added get_server to centralize SMTP connection logic |
src/load_welcome.py | Added display_welcome to handle loading and printing welcome |
src/emailbomber.py | New orchestration function tying together all modules |
src/e_mail.py | Split email detail input, message creation, and bulk sending |
src/crendentials.py | Added credential load/save utilities |
src/authentication.py | Added login_to_smtp to handle authentication errors |
main.py | Updated entrypoint to use email_bomber() |
Dockerfile | Adjusted COPY/CMD to accommodate new module layout |
Comments suppressed due to low confidence (2)
src/crendentials.py:1
- Filename 'crendentials.py' appears misspelled; rename to 'credentials.py' and update imports accordingly to avoid confusion.
import getpass
src/server.py:1
- No tests have been added for 'get_server'; consider adding unit tests to cover successful connections and handled exceptions.
import smtplib
raise ValueError("Count must be positive.") | ||
break | ||
except ValueError as e: | ||
raise ValueError(f"Invalid input: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This except block re-raises a ValueError on invalid count input, exiting instead of re-prompting; consider printing the error and using 'continue' to allow the user to retry.
raise ValueError(f"Invalid input: {e}") | |
print(f"Error: {e}. Please try again.") | |
continue |
Copilot uses AI. Check for mistakes.
with open(f"{file_path}/sender.txt", "w") as sender_file: | ||
sender_file.write(sender) | ||
with open(f"{file_path}/app_password.txt", "w") as password_file: | ||
password_file.write(app_password) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storing application passwords in plaintext poses a security risk; consider using an OS keyring or encrypting the credentials on disk.
Copilot uses AI. Check for mistakes.
server = smtplib.SMTP(smtp_server, smtp_port) | ||
server.starttls() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] It’s recommended to call 'server.ehlo()' before and after 'starttls()' to ensure proper SMTP handshake and compliance with server requirements.
server = smtplib.SMTP(smtp_server, smtp_port) | |
server.starttls() | |
server = smtplib.SMTP(smtp_server, smtp_port) | |
server.ehlo() | |
server.starttls() | |
server.ehlo() |
Copilot uses AI. Check for mistakes.
|
||
def display_welcome(filepath=WELCOME_FILE): | ||
"""Displays the welcome message from a file.""" | ||
parent_dir = os.path.abspath(os.getcwd()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolving the welcome file relative to the current working directory may break if run elsewhere; consider using 'os.path.dirname(file)' or pathlib to reference the module's directory.
parent_dir = os.path.abspath(os.getcwd()) | |
parent_dir = os.path.abspath(os.path.dirname(__file__)) |
Copilot uses AI. Check for mistakes.
@ngawa-tafe you may work upon the suggestion given by copilot |
Modularize the code by breaking it down into smaller functional parts.
update docs and refactor #18