This tool is designed to test SMTP server credentials from a sample file and report on their validity.
- Python Environment: Ensure you have Python set up on your machine.
- Python Libraries: This tool uses the
smtplib
andos
standard libraries. - SMTP Sample File (
smtps.txt
): The file should have the following structure:
URL: <URL>
METHOD: <METHOD>
MAILHOST: <SMTP_HOST>
MAILPORT: <SMTP_PORT>
MAILUSER: <SMTP_USER>
MAILPASS: <SMTP_PASS>
MAILFROM: <MAIL_FROM> (Optional)
FROMNAME: <FROM_NAME> (Optional)
- Environment Variables: Store default email subject and recipient in an
.env
file: DEFAULT_EMAIL_SUBJECT
DEFAULT_RECIPIENT
- Load Environment Variables: Extract values from the
.env
file. - Extract SMTP Details: Read the
smtps.txt
sample file. - Test SMTP Credentials:
- Use provided
MAILFROM
andFROMNAME
or defaults if not provided. - Handle both port 465 (SSL) and ports [587,585, 1025, 2525, 25] (TLS).
- Write Results:
- Success: Working SMTP credentials are saved to
working_smtps.txt
. - Failure: Failed SMTP credentials, along with errors, are saved to
failed_smtps.txt
. Both files maintain the structure of the sample file.
- Ensure the SMTP sample file (
smtps.txt
) is in the same directory as the script. - Execute the script:
python main.py
. - Review Results:
- Valid Credentials: Check
working_smtps.txt
. - Invalid Credentials: Refer to
failed_smtps.txt
.