EMAIL API kullanarak e-posta gönderme
Aşağıdaki kod ile servicenow standart email api’sini kullanarak eposta gönderebilirsiniz.
var url = 'https://dev186271.service-now.com/api/now/v1/email'; var username = 'denemeUser'; var password = 'xxxxxxx'; var data = { to: [ 'User1 <user1@example.com>', 'User2 <user2@example.com>' ], cc: [ 'User3 <user3@example.com>', 'User4 <user4@example.com>' ], bcc: [ 'User5 <user5@example.com>', 'User6 <user6@example.com>' ], subject: 'Hello There', text: 'Test Message', html: '<b>Test Message</b>', table_name: 'incident', table_record_id: '061b4b6d938002104d1a3a4efaba1005', headers: { 'X-Custom': 'header' } }; var request = new sn_ws.RESTMessageV2(); request.setEndpoint(url); request.setRequestHeader('Accept', 'application/json'); request.setRequestHeader('Content-Type', 'application/json'); request.setRequestHeader('Authorization', 'Basic ' + GlideStringUtil.base64Encode(username + ':' + password)); request.setHttpMethod('post'); request.setRequestBody(JSON.stringify(data)); var response = request.execute(); var responseBody = response.getBody(); var httpStatus = response.getStatusCode(); gs.info('Response: ' + responseBody); gs.info('HTTP Status: ' + httpStatus);