Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception Handling: MailSenderException #3

Closed
Flashky opened this issue Dec 9, 2018 · 1 comment
Closed

Exception Handling: MailSenderException #3

Flashky opened this issue Dec 9, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@Flashky
Copy link
Owner

Flashky commented Dec 9, 2018

Bad credentials

When using an incorrect password for ```MAIL_PASSWORD``:

org.simplejavamail.mailer.internal.mailsender.MailSenderException: Third party error
[...]
Caused by: javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at

When using bad credentials:

  1. Log as error.
  2. Log cause as error.
  3. Terminate program.

Unknown SMTP host

When using an invalid SMTP hostname:

simplejavamail:
  smtp:
    host: smtp.gmail.commmmmm

`
The following exception will ocurr:

org.simplejavamail.mailer.internal.mailsender.MailSenderException: Third party error
[...]
Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmaill.com, 587; timeout -1;
[...]
Caused by: java.net.UnknownHostException: smtp.gmaill.com
[...]

Either the host server is down at that moment, or the hostname is incorrect.

First, we should do a test connection when the Mailer object is created. If that test worked and we get this exception later, we can confirm at 99,9% that the server is just down.

Therefore, we should handle as it follows:
When test connecting

@Flashky Flashky added the enhancement New feature or request label Dec 9, 2018
@Flashky Flashky modified the milestones: Undetermined, 2.3.0 Dec 21, 2018
@Flashky
Copy link
Owner Author

Flashky commented Jun 18, 2019

Won't be done for now.

@Flashky Flashky closed this as completed Jun 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant