Code Monkey home page Code Monkey logo

gomail's Introduction

goMail

goMail is a simple REST API built in Golang that allows you to send SMS via email. It utilizes a combination of technologies including Golang, Gin, Lumberjack v2, SMTP, GORM, GORM Postgres driver, PostgreSQL, godotenv, and viper.

Table of Contents

Prerequisites

Before you begin, ensure you have met the following requirements:

  • Go (Golang) installed. You can download it from the official website.
  • PostgreSQL database with necessary configurations.
  • SMTP server details to send emails.
  • Basic understanding of the stack used in this project.

Installation

  1. Clone this repository:

    git clone github.com/icoder-new/goMail
    cd goMail
  2. Install the required dependencies:

    go mod tidy

Configuration

  1. Create a .env file in the project root directory and configure the following environment variables:

    GIN_MODE=debug
    
    DB_PASSWORD=database_password
    SMTP_PASSWORD=smtp_password
    
  2. Modify the SMTP, database, and other settings as per your requirements.

Internal folder

Here is confidential information for accessing the web page that provides currency data. You have the option to customize the content and modify the SMTP message handler text before running project.

Usage

To start the goMail REST API server, run the following command:

go run ./cmd

The API server will start on the specified port (default is 3333).

Endpoints

The goMail REST API provides the following endpoints:

  • GET / - A simple endpoint to check if the server is running.
  • GET /api/v1 - A test endpoint for the POST method to send SMS via email.
  • POST /api/v1/send - Send an SMS via email. You need to provide a JSON request body with the following fields:
    • firstname (string): First name of the recipient.
    • lastname (string): Last name of the recipient.
    • email (string): Email address of the recipient.
    • subject (string): Subject of the email.
    • message (string): Message to send via email.

Example

Here's an example of how to send an SMS via email using the API:

curl -X POST http://localhost:3333/api/v1/send -H "Content-Type: application/json" -d '{
    "firstname": "John",
    "lastname": "Doe",
    "email": "[email protected]",
    "subject": "Hello from goMail",
    "message": "This is a test message sent via goMail."
}'

Contributing

Contributions are welcome! If you'd like to contribute to this project, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

gomail's People

Contributors

icoder-new avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.