ServiceNow REST API: Including Reply-To value when sending email via POST

tmccaffrey15
Tera Contributor

Currently I am using the Rest API to send emails, and I am trying to include the Reply-To value in my POST, however it is not being accepted.

 

When running, I am met with this error:

 

 

{'error': {'message': 'Error sending email', 'detail': 'Email validation failed: Some headers cannot be filled out in email: Reply-To'}, 'status': 'failure'}

 

 

I can send the POST successfully without including the Reply-To value. Would appreciate some help on understanding why I cannot include the Reply-To value in my post despite it being in the correct syntax.

 

2 REPLIES 2

Tushar
Kilo Sage
Kilo Sage

Hi @tmccaffrey15 

 

The ServiceNow REST API does not allow you to directly modify the Reply-To header for individual emails.

However, you can achieve the desired Reply-To behavior by configuring the Reply-To address within email account configurations or email templates.

The SMTP server will handle the inclusion of the Reply-To header based on the email account settings or the email template.

 

  • Email account configurations: You can configure the Reply-To address within email account settings. The SMTP server you configure for sending emails will handle the inclusion of the Reply-To header based on these settings.
  • Email templates: When using the REST API to send emails, you can specify an email template that contains the desired Reply-To address. The template will ensure that the correct Reply-To header is included when the email is sent via the configured SMTP server.

While direct manipulation of the Reply-To header is not possible through the REST API, using email templates and account configurations you can achieve the desired Reply-To behavior with the assistance of the SMTP server.

 


Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

Thanks for the response Tushar.

 

Understood, so the headers cannot be simply provided through the API call and I must instead use either the template or configure the email account.

 

To use the template in the API, how would I go about providing this in the POST? Going through the documentation, I'm not able to find information on the header should be provided in the API call. Any help finding how to implement this would be much appreciated!