Skip to content

Project to test if the server can sent emails

Notifications You must be signed in to change notification settings

dads-software-brotherhood/mail-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mail test application

This application is used for test if java can send email in local server.

Usage

Three options:

Set configuration in application.yml

Edit the application.yml file before build the application. Set the correct info in spring.mail section (see https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-email.html)

After build use with the correct profile and an email:

java -Dspring.profiles.active=production -jar target/mail-test-0.0.1-SNAPSHOT.jar "[email protected]"

or with extra params:

java -Dspring.profiles.active=production -jar target/mail-test-0.0.1-SNAPSHOT.jar "[email protected]" "subject" "message"

Set configuration in application.yml with encrypted info

If you need crypt info (like the password), you can crypt any configuration key in application.yml with jaspyt framework.

Firts, you need crypt the key_value:

java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="KEY_VALUE" password="custom-password" algorithm=PBEWithMD5AndDES

Use a custom password and don't storage in 'application.yml'

Sample output:

# java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="a key value" password="custom-password" algorithm=PBEWithMD5AndDES

----ENVIRONMENT-----------------

Runtime: Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.162-b12



----ARGUMENTS-------------------

algorithm: PBEWithMD5AndDES
input: a key value
password: custom-password



----OUTPUT----------------------

VnS9Hrbh5KlmqZXeW9E2A1Y9JCh3F0YM

Use the output with ENC command, like:

spring:
    mail:
        password: ENC(VnS9Hrbh5KlmqZXeW9E2A1Y9JCh3F0YM)

After build the app, you cant usage with jasypt.encryptor.password enviroment property:

java -Dspring.profiles.active=development -Djasypt.encryptor.password="custom-password"  -jar target/mail-test-0.0.1-SNAPSHOT.jar "[email protected]"

About

Project to test if the server can sent emails

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages