Creating Mail Bounce Emails

General Add comments
by:

One of the requirements from my last implementation was to prevent new incident creation from mail. The simple way to disable this functionality is to make the Inbound Email Action Create Incident inactive. But a requirement was also to send a notification mail back to the original sender of the mail.

A way to achieve this is to create a trigger to send a mail back to the sender. To use this functionality, I used the some things from the Wiki (http://wiki.service-now.com/index.php?title=Events_and_Email_Notification) and created some new functionality to create a bounce mail based on an incoming email action.

Step 1: Register an event

Event name: email_bounce
Table: incident

Step 2: Create a new email notification

Name: Email bounce
Event name: email_bounce
Table: incident
User field: event.parm1
Message:

Dear, ${event.parm1}

Please register your incident via the ESS portal of ServiceNow.

Click here to <a class=”service_catalog” href=”http://demo.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=3f1dd0320a0a0b99000a53f7604a2ef9″ target=”_self”>Create a New Incident</a>

Kind regards,

The Servicedesk

 

Step 3: Disable inbound email action: Create Incident

Just uncheck the Create Incident active checkbox.

Step 4: Create a new inbound email action

Now we need to trigger the event and this will send the notification. Just create a new inbound email action.

Let’s call it a Bounce Email, based on the Incident table. The conditions we don’t use now, but you can extend this to do this on specific conditions. You can use the same conditions that you already use for business rules. For now we don’t use any condition, so we will allow every incoming mail to be handled and send a mail bounce back.

You can access some variables from the email, this you can use to create your condition or use in your inbound email actions. The variables are listed on this page: http://wiki.service-now.com/index.php?title=Inbound_Email_Actions#Variables

So let’s create our script, in the script we using the following code based on the gs.eventQueue function. This function is also user in the global functions to trigger the email notifications, like Incident Events.

var parm1 = email.origemail; //get the original mail address
gs.eventQueue(‘mail.bounce’, null, parm1);

Let’s test the mail solution

Send a mail in the ServiceNow system.
You can see the incoming mail in the received email log.

The inbound email action will trigger the event ’email_bounce’ and you can backtrace in the Event Log


The mail will be prepared in the outbox and will be sent back to the original sender of the mail. This is the email that is sent back to the original email sender.

It’s a simple solution but very effective. If you have any questions about topic, please don’t hesitate to contact me on: lam.hoang@2e2.nl

Leave a Reply