Code Monkey home page Code Monkey logo

mail-sender's Introduction

Gmail to Telegram Bot

This bot is designed to forward messages from Gmail to Telegram. It periodically checks for new emails in a specified Gmail account and sends the content of those emails, including the timestamp, subject, and body, to the specified Telegram user.

Additionally, this bot can be used to send emails by simply typing a message in a specific format. The message should be formatted as follows: recipient_email ; subject ; body The recipient email, subject, and body should be separated by a semicolon and a space.

Installation

Clone this repository to your local machine:

git clone https://github.com/werniq/mail-sender.git cd mail-sender go get .

Before running the bot, you need to configure your Gmail and Telegram API credentials.

Your .env file should contain folllowing information:

  1. TELEGRAM_BOT_TOKEN
  2. YOUR_EMAIL
  3. YOUR_APP_CODE

Gmail Configuration

-- 1. Enable two-factor authentication in your gmail account, and generate application code (Instructions)
-- 2. Rename the downloaded JSON file to credentials.json and place it in the config directory.

Telegram Configuration

-- 1. Create a new bot on Telegram by talking to the BotFather. -- 2. Obtain the bot token and save it for later use.

Create .env file with variables from above

Run your bot using go run

go run bot.go

The bot will check for new emails every 5 minutes and forward any new messages to the specified Telegram user. To send an email using the bot, simply send a message in the following format to your Telegram bot:

recipient_email ; subject ; body Make sure to replace recipient_email, subject, and body with the actual values.

Screenshots

photo_2023-07-01_18-43-23 photo_2023-07-01_18-43-05 photo_2023-07-01_19-53-00

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.

Ideas for contibuting:

1. Update this code to properly sent files

2. Would be interesting to see, how you would implement support for Hebrew language. I've tried to do this, but it works only for title, not for email subject.

mail-sender's People

Contributors

werniq avatar

Stargazers

 avatar Katherine. avatar Prokhar Kulak avatar Nikolai Mishin avatar sg avatar Andrew Erlikh avatar

Watchers

 avatar  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.