This CLI tool allows you to test IMAP and SMTP connection details using provided credentials. You can specify the connection details either through command-line options or a configuration file, but not both.
- Test IMAP and SMTP connections.
- Support for SSL and TLS.
- Provide credentials through CLI or a JSON configuration file.
- Verbose mode for detailed connection information.
- Clone the repository:
git clone https://github.com/a-wiseguy/mail-auth-cli.git
- Navigate to the project directory:
cd mail-auth-cli
- (Optional) Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install the required packages:
pip install -r requirements.txt
You can run the script using either CLI options or a JSON configuration file.
python mail-auth-cli.py --imap-host <IMAP_HOST> --smtp-host <SMTP_HOST> --username <USERNAME> --password <PASSWORD> [OPTIONS]
Create a JSON file (e.g., config.json
) with the following structure:
{
"imap_host": "mail.example.com",
"imap_port": 993,
"smtp_host": "mail.example.com",
"smtp_port": 465,
"username": "[email protected]",
"password": "passwordhere",
"use_tls": false,
"test_imap": true,
"test_smtp": true
}
Run the script with the configuration file:
python mail-auth-cli.py --config-file config.json
--config-file
: Configuration file with connection details in JSON format.--imap-host
: IMAP server host.--imap-port
: IMAP server port (default: 993).--smtp-host
: SMTP server host.--smtp-port
: SMTP server port (default: 465 for SSL, 587 for TLS).--username
: Username for login.--password
: Password for login. If not provided, you will be prompted.--use-tls
: Use TLS for SMTP connection (default: False).--verbose
: Enable verbose output.--test-imap
: Test IMAP connection only.--test-smtp
: Test SMTP connection only.
Testing both IMAP and SMTP connections with verbose output:
python mail-auth-cli.py --imap-host mail.example.com --smtp-host mail.example.com --username [email protected] --password passwordhere --verbose
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
If you encounter any issues, please create a new issue in the GitHub repository.
For any inquiries, please contact [email protected].