rosehgal/TrashEmail

NULL pointer exception with Email id

rosehgal opened this issue · 0 comments

Describe the bug
If the email is something of the form Rohit <example@trashemail.in> 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 <example@trashemail.in>
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)