E-mail Configuration
A Notifier that sends e-mail notifications via the university’s SMTP server. In order to send e-mails, the user’s university e-mail address is needed. In order to be notified of incoming e-mails, the user must have set up an e-mail client that regularly checks the inbox. The following e-mail clients are particularly recommended:
- Mozilla Thunderbird (all desktop platforms)
- GNOME Evolution (Linux)
- K-9 Mail (Android)
Class Diagram
Instantiation
In order to create a new EMailNotifier, you need to provide a Configuration that contains the user’s university e-mail address and the Friedolyn password (which is used for SMTP authentication):
Configuration configuration =
new Configuration("es13nsa", "xkeyscore".toCharArray());
configuration.setEmail(new InternetAddress("edward.snowden@uni-jena.de"));
EMailNotifier notifier = new EMailNotifier(configuration);
If the user wishes to receive PGP-encrypted e-mails, use the
constructor that sets the encryptMailWithPGP
flag.
A PGP public key in the user’s
preferred contact methods is required for this feature to work (if
unset, e-mails will be sent unencrypted):
ContactMethods contactMethods = new ContactMethods("es13nsa");
contactMethods.setPgpPublicKey(
"""
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEZqvKGRYJKwYBBAHaRw8BAQdA2ZJNX0DUD7jMfwINNTauUPLa+39JFRWokyBO
rtgko560J0d1c3RhdiBCbGHDnyA8Z3VzdGF2LmJsYXNzQHVuaS1qZW5hLmRlPokC
...
fl4xN62Stfgsu3EGlfWB/7qrC0Yjp0onbAD9Eo+qDff6va0/xJCJNglJB8s1/SXe
b+tOHF43UeaUTQI=
=byp6
-----END PGP PUBLIC KEY BLOCK-----
"""
);
EMailNotifier notifier = new EMailNotifier(configuration, true);
Settings
Encrypt e-mails with PGP
Whether e-mail notifications should be
encrypted with PGP,
using the student’s public key as specified in
configuration.getContactMethods().getPgpPublicKey()
.
Type | boolean |
JSON key | encrypt-with-pgp |
Default | false |
Note
Javadoc has sadly not recognised the Lombok setter for the encryptMailWithPGP
field, but it does exist.