To receive notifications by email, you must configure SMTP server settings. You can configure SMTP server settings using the Settings Controller API.
The following procedure shows how to configure SMTP server settings with authentication and send a test email to verify the settings.
Prerequisites
- Verify that you have satisfied all general prerequisites. See the prerequisites for Performing Day 2 operations using vRealize Suite Lifecycle Manager APIs.
- Verify that you have the email address from which you want notifications to be sent.
- Verify that you have the following information for your SMTP server:
- Host name or IP address. For example, smtp.office365.com.
- Port number.
- If the server requires authentication, you must provide a username and password. For example, your Office 365 email address and password.
Procedure
- Configure SMTP settings.
curl -X POST \
'$url/lcm/lcops/api/v2/settings/smtp' \
-H 'Authorization: Basic YWRtaW5AbG9jYWw6VGhpc0lzUGFzc3dvcmQ=' \
-H 'Content-Type: application/json' \
-d '{
"authenticationRequired": true,
"encryptionType": "NONE",
"fromEmail": "<your_from_email>",
"password": "<user_account_password>",
"smtpEncryptionPort":"<port_number>",
"smtpHostName": "<your_smtp_hostname>",
"userName": "<user_account_email_address>"
}' | jq "."
The response shows an example of an Office 365 account configured with SMTP server settings.
{
"smtpHostName": "smtp.office365.com",
"smtpEncryptionPort": "25",
"authenticationRequired": true,
"userName": "[email protected]",
"password": "locker:password:21c6bd20-fc92-4a09-b09b-bf4c3fdcf671:smtp-cbceb2b2-fb0c-41fb-9025-d69c1047c73a",
"encryptionType": "NONE",
"fromEmail": "[email protected]"
}
- Send a test email to [email protected].
curl -X GET \
'$url/lcm/lcops/api/v2/testEmail/[email protected]' \
-H 'Authorization: Basic YWRtaW5AbG9jYWw6VGhpc0lzUGFzc3dvcmQ=' \
-H 'Content-Type: application/json' | jq "."
If the response shows
"type": "SUCCESS", the SMTP server settings are correct and
[email protected] is a valid email recipient.
{
"vmid": "5bdab51a-07a1-4b97-875b-5d4ffed31ffe",
"transactionId": null,
"message": "Email sent successfully",
"identifier": null,
"type": "SUCCESS"
}
What to do next
Configure an outbound notification with an email recipient. See
Configure Outbound Notification Settings.