Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com

Email Configuration

 

General Email Configuration

For email configuration in OpenSpecimen via UI, go to the settings → email 



Below are the REST APIs for configuring email module settings:

openspecimen/rest/ng/config-settings

Use this resource to configure email settings in the OpenSpecimen application. Use HTTP PUT method to call this API by passing the below details in JSON format:



Parameter Details :

The user authentication API takes the following parameters in json request :

Parameter

Details

Parameter

Details

module

Name of the module for which you are updating the configurations.

Currently there are 2 modules:

  1. email

  2. common

name

Name of the property for which you want to update/add the value

  1. server_host : Email server host, e.g smtp.google.com

  2. server_port: Email server port, e.g 25

  3. account_id: Email Id which will be used to send the emails, e.g. test@gmail.com

  4. account_password: Provide password to authenticate mail server if required

  5. starttls_enabled: Set true if required

  6. auth_enabled: Set true if required

  7. admin_email_id: Email id of admin, by default all emails are cc in to admin. e.g. admin@admin.com

  8. app_url: application URL which should be sent in the emails, e.g. http://localhost:8080/openspecimen

value

The actual value of the above specified property names.



http[s]:<host>:<port>/openspecimen/rest/ng/config-settings

Use this URL to configure/update the properties



Result:

The response of this request will contains the details of the added/updated property.

Below is the example of the register authentication domain:

  1.  Sets email server host

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

  "module": "email",

  "name": "server_host",

  "value": "localhost"

}

Response

{

  "module": "email",

  "name": "server_host",

  "value": "localhost"

}



      2.  Sets email server port

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

  "module": "email",

  "name": "server_port",

  "value": "25"

}

Response

{

  "module": "email",

  "name": "server_port",

  "value": "25"

}



3.  Sets email account id

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

 "module": "email",

  "name": "account_id",

  "value": "test@gmail.com"

}

Response

{

 "module": "email",

  "name": "account_id",

  "value": "test@gmail.com"

}



4.  Sets email account id

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

 "module": "email",

  "name": "account_password",

  "value": "password"

}

Response

{

 "module": "email",

  "name": "account_password",

  "value": "password"

}



5.  Set mail.smtp.starttls.enable

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

 "module": "email",

  "name": "starttls_enabled",

  "value": "true"

}

Response

{

 "module": "email",

  "name": "starttls_enabled",

  "value": "true"

}



6.  Set mail.smtp.auth

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

 "module": "email",

  "name": "auth_enabled",

  "value": "true"

}

Response

{

 "module": "email",

  "name": "auth_enabled",

  "value": "true"

}

7. Set admin email id

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

 "module": "email",

  "name": "admin_email_id",

  "value": "admin@admin.com"

}

Response

{
"module": "email",
"name": "admin_email_id",
"value": "admin@admin.com",
}

8.  Sets application url (this belongs to common module)

URL

/openspecimen/rest/ng/config-settings

Method

PUT

Request

application/json

json

{

 "module": "common",

  "name": "app_url",

  "value": "http://localhost:9000"

}

Response

{

 "module": "common",

  "name": "app_url",

  "value": "http://localhost:9000"

}





Error cases :

This section describes the response cases for register authentication API

code

Applies to

Status Message

code

Applies to

Status Message

200

All resources

Domain has been registered successfully

400

All requests

Invalid parameters, e.g  blank implClass in-case of custom domain, duplicate domain name etc

401

All requests

Authorization failed, user doesn’t have authority

500

All requests

Internal server error, encountered server error while performing operations or provided wrong ldap information



Email Configuration for no authentication/no password

In most cases, the SMTP server requires authentication to send emails. However, some servers don't need authentication. In such cases, if you use the general email configuration, then you will get the below error:

Error:

[{"code":"EMAIL_UNABLE_TO_SEND","message":"Unable to send email. Verify your email server settings. For details, refer to the error (Authentication failed; nested exception is javax.mail.AuthenticationFailedException: No authentication mechanisms supported by both server and client) stack trace in os.log file."}]

 

Hence, you need to make the below changes in the email configuration comparison to the general email setting to allow the server to send email:

Please note: You need to either perform #2.a OR #2.b. 

  1. Disable SMTP authentication: Go to Setting → Email → SMTP authentication → Disable → Update.

  2. Update Account ID to non-email address OR Remove password for the email:

    a) Go to Setting → Email → OpenSpecimen Account → Add 'apikey' → Update.

     b) Go to Setting → Email → Account Password → 'Add empty value' → Update.

















Got feedback or spotted a mistake?

Leave a comment at the end of this page or email contact@krishagni.com