Skip to content

Instantly share code, notes, and snippets.

@mbtools
Created December 29, 2021 22:39
Show Gist options
  • Save mbtools/dae6501b773b48cc4983ab30a0d16e15 to your computer and use it in GitHub Desktop.
Save mbtools/dae6501b773b48cc4983ab30a0d16e15 to your computer and use it in GitHub Desktop.
Adjust the setup of the SMTP node for SendGrid
************************************************************************
* ZBC_SENDGRID_SETUP
*
* Helper: Adjust the setup of the SMTP node for SendGrid
*
* (c) Marc Bernard Tools 2021
************************************************************************
REPORT zbc_sendgrid_setup.
" SendGrid Host
CONSTANTS gc_smtp_host TYPE string VALUE 'smtp.sendgrid.net'.
" SendGrid API user must be lower case!
CONSTANTS gc_smtp_user TYPE string VALUE 'apikey'.
DATA gs_node TYPE sxnodes.
SELECT SINGLE * FROM sxnodes INTO gs_node
WHERE node = 'SMTP' AND mail_host = gc_smtp_host.
IF sy-subrc <> 0.
WRITE: / 'SendGrid SMTP node not found' COLOR COL_NEGATIVE.
RETURN.
ENDIF.
gs_node-smtpuser = gc_smtp_user.
UPDATE sxnodes FROM gs_node.
IF sy-subrc = 0.
WRITE: / 'SendGrid SMTP node updated' COLOR COL_POSITIVE.
ELSE.
WRITE: / 'Error updating SendGrid SMTP node' COLOR COL_NEGATIVE.
ENDIF.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment