Giter Site home page Giter Site logo

rosehgal / trashemail Goto Github PK

View Code? Open in Web Editor NEW
536.0 11.0 65.0 5.01 MB

A hosted disposable email telegram bot; Extremely privacy friendly; Proudly hosted for community.

Home Page: https://t.me/trashemail_bot

License: Apache License 2.0

Java 96.55% Dockerfile 0.47% Shell 0.21% Makefile 2.77%
telegram-bot temp-email trash-email disposable-email telegram java spring mailbox reliability java-spring-boot

trashemail's Introduction

Build StatusBot Gitter GitHub language count GitHub code size in bytes GitHub issues GitHub closed pull requests Twitter Follow GitHub followers

tl;dr

TrashEmail is hosted Telegram bot that can save your private email address by offering disposable email address. It can create, manage, disposable email address and link them with your telegram bot chat.

  • Where is the bot? - @trashemail_bot
  • How can I create dispoable mail id? - Decide a username & ask the bot ๐Ÿ˜„
  • How many email ids can I own at a time? - Right now, the count is 8.
  • How can I access my emails? - If there is an email for you, it will come to telegram ๐Ÿ˜„ Easy right.
  • Do I need to setup and remember any password? - No Sir, that's the trick.
  • Why am I maintaining and hosting this? - This is my first such tool for community ๐Ÿ˜„ I wanted to give something back to community. If you like the idea and wanted to contribute then you can BuyMeACoffee
  • How many users are currently using it? - The information about active registered users and latest version of this service can be found here: https://trashemail.in

Trashemail Dashboard

How can I use this hosted service:

  • Its super easy, just see the demo below.

Video on How to use it

What is Disposable Temporary E-mail? And How am I different?

Forget about spam, advertising mailings, hacking and attacking robots. Keep your real mailbox clean and secure.Trashemail provides temporary(or permanent), secure, anonymous, free, disposable email address. Want to get one ? its here : @trashemail_bot

Disposable email - is a service that allows to receive email at a temporary(Here in case, the temporary factor is upto you) address that self-destructed after a certain time elapses. It is also known by names like : tempmail, 10minutemail, throwaway email, fake-mail or trash-mail. Many forums, Wi-Fi owners, websites and blogs ask visitors to register before they can view content, post comments or download something.

Trashemail is not most advanced throwaway email service but a reliable service that helps you avoid spam, stay safe and get emails delivered directly to your @trashemail_bot Telegram bot. And in case you are getting too many such mails, just delete the email Id :) with one click(oops command, since this is telegram bot).

There are websites that offers such sort of functionalities (like https://temp-mail.org/en/ etc) but the certain issues with such platforms:

  1. Your information is safe or not you can't audit.
  2. The domain keeps changing as soon as they are identified as temp-mail domains.
  3. Everytime you have to visit site to get one, you can't keep the same temporary mail for long.
  4. And, their business model which makes you see lot of ads in website.

Considering all of this, I decided to make a open source project out of my hobby and thought of offering it as a service to others :) How my service is better than theirs:

  1. The entire source code is open for audit, I am not interested in your data at all.
  2. Right now I own a domain trashemail.in and you will get emailIds from this domain only. (Easy for you to remember).
  3. The temporary time for your emailId to be alive is on you, not on the server, you can keep it permanently as well, or as long as I am able to maintain the @trashemail_bot.
  4. This project is out of passion, so I don't have motive of earning anything, so No Ads.(I am serious, I hate them too, like you)
  5. I am always open to suggestion, feedback & Issues to work on.

Let's talk about the Source.

TrashEmail is Java spring-boot microservice that anyone can build locally currently with few setting to tune in and then have the entire setup running locally. All you need to own is mail server(SMTP and IMAP), telegram bot token and mvn locally to build it. Few requirements with the mailserver:

  1. SMTP host should allow Alias creation.
  2. IMAP server should support IDLE.

I have to update the config slightly, and will do it quickly. :)

All you need to do is clone the source, build and run, and just tell telegram that you are listening here.

git clone https://github.com/r0hi7/Trashemail.git
cd Trashemail

# Copy EmailsToTelegramServiceConfig-sample.yml and
# TrashEmailServiceConfig-sample.yml files
# according to your environemnt
# Let's say you want to deploy it for dev env
# Then copy these files like

cp EmailsToTelegramServiceConfig-sample.yml EmailsToTelegramServiceConfig-dev.yml
cp TrashEmailServiceConfig-sample.yml TrashEmailServiceConfig-dev.yml

# Now modify the respective copied files with your configs
# Similarly, it can be deployed be "qa", "prod" environments
# Finally, run the script build-and-run.sh with env as an argument

bash build-and-run.sh dev

# If you dont want to deploy it in docker-compose, then
# Use Makefile directly
# It will create targets for EmailsToTelegramService and TrashEmailService respectively

make dev

Dev configs may look like this: EmailsToTelegramServiceConfig-dev.yml

# Email Server IMAP and SMTP configuration
# SMTP server should support Alias creation and deletion
# IMAP server should support IDLE

trashemail:
  host: trash-email-service
  port: 9090
  path: /getChatId/

imap-client-service:
  telegram:
    url: https://api.telegram.org/bot
    bot-token: xxxxxxxxxxxxxxxxxxxxxx
    size: 4096
  imap:
    host: trashemail.in
    port: 993
    email: [email protected]
    password: changeme
  emails:
    hostPath: http://127.0.0.1:8000/
    downloadPath: /opt/EmailsToTelegramService/mails/

# main will specify springboot application to
# no start any tomcat server, which is not even
# required for emailservice.
spring:
  application:
    name: EmailsToTelegramService
  main:
    web-application-type: none

TrashEmailServiceConfig-dev.yml

# Tomcat server settings
server:
  port: 9090

#Email server configuration for SMTP alias creation
email-server:
  hosts:
    - trashemail.in
    - thromail.com
    - humblemail.com
  admin-email: [email protected]
  admin-password: sample
  add-url: https://trashemail.in/admin/mail/aliases/add
  remove-url: https://trashemail.in/admin/mail/aliases/remove
  target-alias: [email protected]


# Sample config for connecting with mysql-docker
spring:
  datasource:
    url: jdbc:mysql://mysql:3306/trashemail
    username: root
    password: changeme
    driver-class-name: com.mysql.jdbc.Driver
  jpa:
    database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
    hibernate:
      ddl-auto: update
    show-sql: true
  application:
    name: Trashemail



# Trashemail app server settings
trashemail:
  max-emails-per-user: 4

# Logger settings
logging:
  level:
    io:
      github:
        trashemail: debug
  1. This code will spin up the service at localhost:9090/telegram/new-message endpoint.
  2. Now will have to expose this service to internet, and there are options like : ngrok, dataplicity, localtunnel etc.
    • Start ngrokwith http on port 9090
    • Get the ngrok https url
  3. DB is taken care by mysql
  4. Get a bot for you from, Telegram Bot Father
  5. The last step is important, tell telegram that where you are listening :). Set up the webhook, this webhook will tell telegram where to send the bot incoming requests
    curl -F "url=https://<YOUR_DOMAIN>/telegram/new-message" https://api.telegram.org/bot<BOT_TOKEN>/setWebhook
  6. And you are done.

How It Works

  1. For this bot to work, you need existing SMTP, IMAP setup.
    1. SMTP with Alias creation
    2. IMAP with IDLE enabled
  2. As user, requests for creation,
  3. It fools the user, that it created an email Id rather it creates an alias to exiting ID.
    1. Why Alais, as IMAP needs to poll right, for incoming mails? This is how it is engineered.
  4. Runs a background async service to poll IMAP server.
  5. As soon as mail is fetched, the target is identified and telegram message is sent.

I have tried to engineer this service to be reliable, in case if you find any issues with the reliability(or with anything else), please feel free to drop in a PR. I would be happy to review and merge.

Sponsors

  1. Two domains thromail.com & humblemail.com are proudly donated by zlipa.com. Zlipa offers domains names for startups, bootstrapper etc with 10X lesser market price. Exciting right? Just checkout once.

  2. If you like the idea, then buy me a coffee, I will get caffine in my blood and to spend extra nights to make this product secure, up and running ๐Ÿ˜„

Buy Me A Coffee

  1. Or you can drop in a โญ, this motivates me.

Credits

TelegramAllTheThings

Infrastructure model

Insfrastructure model

trashemail's People

Contributors

0xflotus avatar laautarolopez avatar nishitm avatar nyorja avatar rosehgal avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trashemail's Issues

Jackson bind throws Exception with non TelegramRequest

Describe the bug
When Telegram request was not parsed properly it was throwing exception, which is not handled currently. Due to which the telegram was piling up all the requests and other requests were not even responding.

ERROR 1661 --- [nio-9090-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

java.lang.NullPointerException: null
	at io.github.trashemail.Telegram.TelegramResource.messageHandler(TelegramResource.java:34) ~[classes!/:1.0.0]
	at jdk.internal.reflect.GeneratedMethodAccessor85.invoke(Unknown Source) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:109) ~[spring-boot-actuator-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
	at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

BYE server shutdown

Describe the bug

javax.mail.FolderClosedException: * BYE Server shutting down.
	at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:2538)
	at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2336)
	at com.sun.mail.imap.IMAPFolder.idle(IMAPFolder.java:2252)
	at io.github.trashemail.EmailInteraction.ImapClient$IdleThread.run(ImapClient.java:117)

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version 1.0.0

Be more precise on SMTP Alias Creation Requirements

I think SMTP Alias Creation feature is not standard.
It seems you use internally mailinabox
Maybe you should document it in your README, that you expect users to run their admin panel.
More specifically I would mention that:

  • This project is tailored for MailInABox
  • The SMTP Alias Creation is done by sending HTTP Requests to their admin API
  • Optionally document the form of the request to enable people not using mailinabox to reimplement the API
  • Optionally provides a milter/filter for postfix/opensmtpd

Kudos for the project.

Cleanify the bot reply messages.

Currently for /start and other help messages, there are really long output that telegram throws back to the user. Make it small and impactful.

Beautiful public dashbaord.

Is your feature request related to a problem? Please describe.
Right now the admin data is only projected as JSON endpoint. Make beautiful dashboard beautiful.

Support for multiple targets for load balancing.

This is feature enhancement for load balancing.
Changes needs to be done:

  • TelegramService: it will randomly pick a target from the list of target email addresses.
  • EmailService: It will have to create separate threads to connect with different accounts.

Dashboard for Admin

Is your feature request related to a problem? Please describe.
Dashboard for admins to see the number of user, number of emails registered. I think good idea would be to leverage spring MVC.

ImapClient: javax.mail.FolderClosedException

Since the schedular is used to connect to the Imap IDLE server, and the entire implementation of server ImapClient in in multithread mode with restart rate set to 120000, which is causing this exception .

javax.mail.FolderClosedException
	at com.sun.mail.imap.IMAPMessage.getProtocol(IMAPMessage.java:145)
	at com.sun.mail.imap.IMAPMessage.loadBODYSTRUCTURE(IMAPMessage.java:1279)
	at com.sun.mail.imap.IMAPMessage.getContentType(IMAPMessage.java:450)
	at javax.mail.internet.MimeBodyPart.isMimeType(MimeBodyPart.java:1050)
	at javax.mail.internet.MimeMessage.isMimeType(MimeMessage.java:985)
	at io.github.teledot.utils.MailParser.getTextFromMessage(MailParser.java:53)
	at io.github.teledot.utils.MailParser.<init>(MailParser.java:29)
	at io.github.teledot.Telegram.ForwardMailsToTelegram.sendToTelegram(ForwardMailsToTelegram.java:28)
	at io.github.teledot.EmailInteraction.ImapClient$1.messagesAdded(ImapClient.java:81)
	at javax.mail.event.MessageCountEvent.dispatch(MessageCountEvent.java:150)
	at javax.mail.EventQueue.run(EventQueue.java:134)
	at java.base/java.lang.Thread.run(Thread.java:834)

Messaging Exception : Connection Refused

Describe the bug
The log shows the messaging exception.

javax.mail.MessagingException: Connection refused (Connection refused);
  nested exception is:
	java.net.ConnectException: Connection refused (Connection refused)
	at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:665)
	at javax.mail.Service.connect(Service.java:295)
	at javax.mail.Service.connect(Service.java:176)
	at javax.mail.Service.connect(Service.java:196)
	at io.github.trashemail.EmailInteraction.ImapClient.ensureOpen(ImapClient.java:155)
	at io.github.trashemail.EmailInteraction.ImapClient$IdleThread.run(ImapClient.java:115)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:609)
	at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:285)
	at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:288)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
	at com.sun.mail.iap.Protocol.<init>(Protocol.java:113)
	at com.sun.mail.imap.protocol.IMAPProtocol.<init>(IMAPProtocol.java:110)
	at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:632)

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version 1.0.0

Telegram API parsing error

Describe the bug
There are certain messages, which are not getting parsed by telegram API and /sendmessage api is throwing exception in that case. This is due to default parse_mode value set to Markdown in TelegramRequest class.

Can't create a new temp email.

Describe the bug

Can't register a new temp email on the bot. It says: "Something bad just happened with me. Stay back till I get fixed"

To Reproduce

Steps to reproduce the behavior:

  1. Install bot.
  2. Create a new email.
  3. See error

Expected behavior

Should create a new email to receive emails.

Screenshots
Screenshot_20200601-145030_Telegram

Smartphone (please complete the following information):

  • Device: Android, Samsung M40
  • OS: Android 10

A better way to create emails

/create [email protected]

This is unnessarily long. It should be

/create myemail


Even if you have multiple domains, users shouldn't have to type the full domain.

Step 1: /create myemail

Step 2: [prompt chose one of these domains for your new email]

  1. newtrashemail.in
  2. trashemail.in

Step 3: Congratulations. Your new email is [email protected]

Endpoint for Admins to broadcast message to all the users

Is your feature request related to a problem? Please describe.
Can we have endpoint available for admins to broadcast messages to all the users? This can used by teams who wants to run some sort of ad campaigns.

Describe the solution you'd like
A Web form, only access to admins, make it secure.

Support to view Entire HTML mail.

Is your feature request related to a problem? Please describe.
Currently the HTML email is converted to textual representation. Offer link so that people can open the HTML version for that.

One email delivered twice on telegram

Describe the bug
(Improper Email address parsing)? leads to multiple messages on telegram.

Example

  1. If Recipient is John Doe<[email protected]> here John Doe is name and [email protected] is email
  2. If Recipient is [email protected]<[email protected]> here [email protected] is name and [email protected] is email address.
    Now the Buggy case
  3. Similiarly If Recipient is [email protected]<[email protected]> here [email protected] is name and email address. It should be delivered once. but is delivered twice on telegram.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new trashemail id say [email protected]
  2. Compose an email to [email protected]<[email protected]>

Expected behavior
Email should be received once on Telegram.

Actual behavior
Email is received twice on Telegram.

Message parsing is not working as expected.

Describe the bug
Message parsing is not working as expected. If you send a very basic HTML mail from any mail service. Following parameters a coming out to be true.

MailParser    : Is plain content true
MailParser    : Is HTML content true
MailParser    : Is multipart true
MailParser    : Is plain content Empty false

Due to which, this statement is never reached. https://github.com/r0hi7/Trashemail/blob/b67de8bfface2386071b32b9a9930d90a77d8b20/src/main/java/io/github/trashemail/utils/MailParser.java#L39
Because this is evaluated to false: https://github.com/r0hi7/Trashemail/blob/b67de8bfface2386071b32b9a9930d90a77d8b20/src/main/java/io/github/trashemail/utils/MailParser.java#L38

To Reproduce
Steps to reproduce the behavior:

  1. Send an HTML mail from good with the following content.
**Bold text**
_Italic_

Expected behavior
Since this is multipart mail, the HTML field should be processed. And HTML message should be recorded.

Emails getting missed/blank emails with subject only.

Describe the bug
In the current state Custom email parser is used, which is written in this application code. The issue with the current implementation is that few of the mails are getting missed out. Since I am not logging content of which such emails are getting missed out, its difficult to look the root of this issue and fix it.

To Reproduce
Steps to reproduce the behaviour:

  1. Try sending any email with image content or html content in it. It might work as well.
  2. Try sending any HTML email from https://putsmail.com/

Can we use this : https://commons.apache.org/proper/commons-email/apidocs/org/apache/commons/mail/util/MimeMessageParser.html for parsing email.

Delay

Hello,

I discovered your bot on privacytoolsio reddit. Great work!

I came across unexpected behaviour. When I am sending an message to the email created by Trashemail Bot, it comes to my Telegram with significant delay. Delay is about 5-10 minutes, which can kind of annoying when you want to confirm a link quickly.

Could you please investigate?

This bot is simply amazing and I really appreciate your work.

NULL pointer exception with Email id

Describe the bug
If the email is something of the form Rohit <[email protected]> the email lookup with EmailsToTelegramService is failing and is not delivered to the user.

To Reproduce
Send an email with Name and email id in to field. This happens when the server send mail as contact.

2020-06-16 16:01:51.929 ERROR 10969 --- [Mail-EventQueue] i.g.t.E.ForwardMailsToTelegram           : Unable to find chatId for EmailId: Rohit <[email protected]>
java.lang.NullPointerException
        at io.github.trashemail.EmailsToTelegramService.ForwardMailsToTelegram.getChatIdFromEmailId(ForwardMailsToTelegram.java:57)
        at io.github.trashemail.EmailsToTelegramService.ForwardMailsToTelegram.sendToTelegram(ForwardMailsToTelegram.java:74)
        at io.github.trashemail.EmailsToTelegramService.ImapClient$1.messagesAdded(ImapClient.java:77)
        at javax.mail.event.MessageCountEvent.dispatch(MessageCountEvent.java:150)
        at javax.mail.EventQueue.run(EventQueue.java:134)
        at java.base/java.lang.Thread.run(Thread.java:834)

Pushing attachments with incoming mails.

Is your feature request related to a problem? Please describe.
In the current release if the user gets an email with attachments, then the attachments gets ignored.

Describe the solution you'd like
In case incoming mail contains an attachment, it should be forwarded to the telegram client as well.

Describe alternatives you've considered
Can we have attachment scanning with VT APIs?

Unauthorized No Body but alias added for Telegram user

Describe the bug
The issue is coming up when the local user is created and the email server while alias creation throws some error. And since the check is not made is the server returned any issue, the email is allocated to the user despite on the server side it was not created.

To Reproduce
Steps to reproduce the behavior:

  1. Add invalid credentials in the config.
  2. Create an email from the telegram

Expected behavior
If the server throws error while email-id creation, the email should not be assigned to the telegram user.

HTML version of email link not over HTTPS

Describe the bug
There is button to display "HTML Version" of email. It redirects with an http:// URL and not https://

To Reproduce
Steps to reproduce the behavior:

  1. Send urself an email (with HTML content?)
  2. In bot click on "HTML Verison" button

Expected behavior
URL must begin with https://

Screenshots
notHTTPS

Suggestions ... ?

If you have any suggestions to make for this bot, please use this thread for discussion.

Unsafe content in HTML emails

Describe the bug
JavaScript and external resources are allowed in "HTML version" of email which might lead to tracking and IP address leakage, and other wide range of security issues.

To Reproduce
Steps to reproduce the behavior:

  1. Send urself an HTML with inline javascript." <script>alert(1)</script>
  2. In bot click on "View HTML"

Expected behavior
By default they should be blocked OR at least user should be given control.

Screenshots
JSinHTMLEmails

Telegram sendMessage imposes a limit of 4096 characters

Describe the bug
Telegram sendMessage API imposes a limit of 4096 characters, so in current scenario, if the server tries to send email of size more than 4096 chars, then server will throw exception due to bad response from telegram.

ERROR 2038 --- [cTaskExecutor-2] .a.i.SimpleAsyncUncaughtExceptionHandler : Unexpected exception occurred invoking async method: public void io.github.trashemail.Telegram.SendTelegramMessage.sendMessage(java.lang.String,java.lang.String)

org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request: [{"ok":false,"error_code":400,"description":"Bad Request: message is too long"}]
	at org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:101) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:170) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:112) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:782) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:740) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:674) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:449) ~[spring-web-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at io.github.trashemail.Telegram.SendTelegramMessage.sendMessage(SendTelegramMessage.java:40) ~[classes!/:1.0.0]
	at io.github.trashemail.Telegram.SendTelegramMessage$$FastClassBySpringCGLIB$$b8c07fb8.invoke(<generated>) ~[classes!/:1.0.0]
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) ~[spring-aop-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) ~[spring-aop-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) ~[spring-aop-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

To Reproduce
Steps to reproduce the behavior:
Just send a mail of size more than 4096 bytes/chars.

Expected behavior
A excepted behaviour is to split the message into chunks of size 4096 and then process.

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.