Skip to content

Sundsvallskommun/api-service-email-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmailReader

Reads emails from mailboxes on a exchange web server. Processes these emails and provides them for clients to retrive.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone [email protected]:Sundsvallskommun/api-service-email-reader.git
    cd api-service-email-reader
  2. Configure the application:

    Before running the application, you need to set up configuration settings. See Configuration

    Note: Ensure all required configurations are set; otherwise, the application may fail to start.

  3. Ensure dependent services are running:

    If this microservice depends on other services, make sure they are up and accessible. See Dependencies for more details.

  4. Build and run the application:

    mvn spring-boot:run

Dependencies

This microservice depends on the following services:

  • Exchange Web service
  • Messaging
    • Purpose: Umbrella service to send different types of messages. Used to send SMS-messages for emails configued with the action SEND_SMS. Also used to send email reports if emails get stuck in the database.
    • Repository: Link to the repository
    • Setup Instructions: Refer to its documentation for installation and configuration steps.

Ensure that these services are running and properly configured before starting this microservice.

API Documentation

Access the API documentation via Swagger UI:

Alternatively, refer to the openapi.yml file located in src/integration-test/resources for the OpenAPI specification.

Usage

API Endpoints

Refer to the API Documentation for detailed information on available endpoints.

Example Request

curl -X GET http://localhost:8080/api/resource

Configuration

Configuration is crucial for the application to run successfully. Ensure all necessary settings are configured in application.yml.

Key Configuration Parameters

  • Server Port:

    server:
      port: 8080
  • Database Settings:

    spring:
      datasource:
        url: jdbc:mysql://localhost:3306/your_database
        username: your_db_username
        password: your_db_password
  • External Service URLs:

    integration:
      messaging:
        base-url: http://dependency_service_url
        token-uri: http://dependecy_service_token_url
        recipient-adress: [email protected] # Used to send reports if emails are stuck
        client-id: your-client-id
        client-secret: your-client-secrect
    
      properties:
          credentials:     
              secret-key: your-super-secret-key   # Used to encrypt passwords
    

Database Initialization

The project is set up with Flyway for database migrations. Flyway is disabled by default so you will have to enable it to automatically populate the database schema upon application startup.

spring:
  flyway:
    enabled: true
  • No additional setup is required for database initialization, as long as the database connection settings are correctly configured.

Additional Notes

  • Credentials configuration

    Use the API to set up the configuration for which email-addresses to monitor

  • Application Profiles:

    Use Spring profiles (dev, prod, etc.) to manage different configurations for different environments.

  • Logging Configuration:

    Adjust logging levels if necessary.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License.

Code status

Quality Gate Status Reliability Rating Security Rating Maintainability Rating Vulnerabilities Bugs

© 2023 Sundsvalls kommun

About

Reads emails from mailboxes on a exchange web server.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages