Connect Email API
The Connect Email API is an optional module that exposes a REST endpoint for sending emails through the sendEmail processor.
The module deploys a flow named connect-email-api with a single endpoint.
The endpoint accepts a JSON payload to send an email through the sendEmail processor. The request payload supports standard email fields such as sender (from), recipients (to, cc, bcc), replyTo, subject, and body (plainTextBody or htmlBody), where to and subject are required fields.
-
Endpoint:
POST /email/send -
Authentication: include the credential type for your service account (for example,
apiKey) -
Request body: use the JSON payload expected by the
sendEmailprocessor
The Email API uses the sendEmail processor and expects the exact JSON payload required by that processor.
For example, this request calls the Email API with the default credential type apiKey:
curl https://api.env-connect-mvp-ingress.local/gridos/rs/connect-email-api/email/send \
--request POST \
--header 'Content-Type: application/json' \
--header 'Accept: */*' \
--header 'apiKey: <your API key>' \
--data '{
"to": [
"to@example.com"
],
"subject": "Test",
"plainTextBody": "Hello world!"
}'
To fetch the API key to test the request, use the following command:
+
kubectl -n <CONNECT_NAMESPACE> get secret connect-email-api-sa -o jsonpath='{.data.apiKey}' | base64 -d
Change Email API Credential Type
|
You cannot change the credential type of an existing Connect service account in place.
If the Connect Email API is already installed and you want to switch to a different credential type such as |
To change the credential type after the Connect Email API has already been installed:
-
Delete the existing
ConnectServiceAccountcustom resource namedconnect-email-api.# command for deleting existing CR of type ConnectServiceAccount with the name 'connect-email-api' kubectl delete csa connect-email-api -
Create or update a values override to change the credential type.
-
For Basic authentication, use the override below:
# Set credentialsType to BasicAuthentication emailApi: connectServiceAccount: credentialsType: BasicAuthentication -
For OIDC, use the override below:
# change credentialType to oidc and provide claims validation script connectServiceAccount: credentialsType: OIDC jwtClaimsMatchJsoniqScript: | #input.sub = "subject" -
For mTLS, use:
# change credentialType to mTLS emailApi: connectServiceAccount: credentialsType: mTLS
-
-
Reapply your Helm or Helmfile deployment so the Deployment Operator recreates the Email API resources with the new credential type.
sendEmail SMTP Configuration
The sendEmail processor requires flow server SMTP configuration. Set these properties in your flow server runtime configuration.
This SMTP configuration is required not only for the Connect Email API, but also for any customer flow that uses the sendEmail processor.
flowserver:
config:
application.yml:
mc:
flow-server:
processor:
email:
smtp:
host: "smtp.example.com"
port: 587
tls: true
auth: "PLAIN"
client:
host: "connect-flowserver.example.com"
username: "smtp-user"
password: "smtp-password"
truststoreCertPem: |-
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
defaultConnectionTimeoutMillis: 5000
defaultReceiveTimeoutMillis: 10000
message:
defaultFrom: "noreply@example.com"
The following table lists the required Email API properties and their configuration details.
| Property | Description | Legal values | Default value |
|---|---|---|---|
|
SMTP server host that receives outbound mail. |
Valid DNS name or IP address. |
|
|
SMTP server port used for the transport connection. |
Integer in the valid TCP port range ( |
|
|
Enables TLS for SMTP transport. |
|
|
|
SMTP authentication mechanism used when logging in to the SMTP server. |
Mechanism name supported by your SMTP server/runtime (commonly |
|
|
Client host identity sent by the SMTP client. |
Valid DNS name or IP address resolvable by the SMTP server. |
|
|
Username for SMTP authentication. |
Non-empty string recognized by the SMTP server. |
|
|
Password/secret paired with |
Non-empty string/secret recognized by the SMTP server. |
|
|
PEM-encoded certificate chain used to trust the SMTP server certificate (for private CA/self-signed setups). |
Valid PEM-encoded X.509 certificate content. Do not require for public CA trust. |
Not set |
|
Default timeout for establishing the SMTP connection. |
Non-negative integer (milliseconds). |
|
|
Default timeout for receiving SMTP server responses. |
Non-negative integer (milliseconds). |
|
|
Fallback sender address when the request does not provide |
Valid email address. |
|
|
Replace all default values with environment-specific SMTP details before you deploy Connect Email API or run customer flows that use |