jonnyseymour
ServiceNow Employee
ServiceNow Employee

Let's talk about

  • Three simple steps to resend emails
  • If the email has attachments, how to pre-prepare them for re-sending
  • How to set the email to be ready to be sent
  • Why do we need to wait until it gets processed

Three simple steps to resend email

I'll try to cover some cases of re-sending emails from an instance.

Most cases, are straight forward. However, if the email has failed or it has attachments, you may want to consider additional steps.

There are three(3) simple steps to resend emails:

  1. If the email has attachments, pre-prepare them for re-sending.
  2. Set the email to be ready to be sent
  3. Wait until it gets processed

Send_mail_2.png

Step 1. If the email has attachments, pre-prepare them for re-sending.

If the email has attachments and it has failed (e.g. IO Message Error), please prepare them for re-sending.

If it does not have attachments, just go to the next step (2).

  1. Open each email with attachment:
    1. Save all the attachments from the email.
    2. Delete all the attachments from the email itself.
    3. Save the email record.
    4. Add all the attachments extracted previously (on step 2).
    5. Save the record.

NOTE: Exporting the XML record and re-importing back does not necessarily work.

Example to show how to pre-prepare email with attachments for re-sending

Open the email, and then go to "manage attachments".

2015-09-25_1513.png

Then save all the attachments:

2015-09-25_1521.png

Then remove all the attachments, and save the email.

2015-09-25_1526.png

Then re-attach all the emails saved previously.

2015-09-25_1529.png

Then save the email.

Step 2. Set the email to be ready to be sent

If the email has errors, fix them. Usual errors are wrong addresses, too many recipients, etc. Validate the error and correct them. Manual fixes sometimes are required.

Then set the email type to "send-ready" and save. Internally, a business rule will run.

Then re-open and set Mailbox = "Outbox" and State = "Ready". Then save.

Example of how to set the email to be ready to be sent

Set the email Type to "send-ready":

2015-09-25_1555.png

Then open each email and set Mailbox = "Outbox", and State = "Ready".

2015-09-25_1601.png

Example script to reprocess emails

An alternative example script to reprocess the emails with "send-failed", "send-ignored", and "send-ready" in all states is:

// Set queryString with the query to perform -- USE CAREFULLY

queryString = "typeINsend-failed,send-ignored,send-ready^sys_created_onONToday@javascript:gs.daysAgoStart(0)@javascript:gs.daysAgoEnd(0)"

var gr = new GlideRecord('sys_email');

gr.addEncodedQuery(queryString);

gr.query();

while (gr.next()) {

      gr.type = "send-ready"; // this is the first update

      gr.update();

      gr.mailbox = "outbox"; // note this happen as a second update

      gr.state = "ready";

      gr.update();

}

   

Additional note: Note there is a "Resend" button if the email Type = "sent".

This is only useful if the email was sent correctly on the first place.

2015-09-25_1605.png

2015-09-25_1606.png

Step 3. Wait until it gets processed

Then if you have enabled the outbound email services, they will be resend on the next cycle.

This is usually 30-sec to 1 minute.

Hopefully they will be sent without problems.

Conclusion

Re-sending emails require three steps. If the email has attachments, pre-prepare the attachments for re-sending, then set the email to be ready to be sent and finally wait until it gets processed

Review what have your learn

After reading this blog you will know:

  • How to re-add attachement to emails
  • How to set an email to be ready to deliver
  • Where is the 'Resend' button on emails

More information can be found here:

Note: Tested in Fuji, with Chrome

3 Comments
Inds
Tera Contributor

Hi team 

 

I need help to reprocess the send-ignore emails which is triggered by the email client. how can i reprocess those emails.

 

i have tried the given solution but it is not reprocessing the send-ignore emails.

 

can any one guide me to solve this problem.

 

Thanks in advance

Susie W
Tera Expert

I'm not an admin but sometimes I find the "message" in the e-mail log tab of a 'send-ignored' email record is helpful.  Eg:

SusieW_0-1742296991222.png

 

gerritkuilder
ServiceNow Employee
ServiceNow Employee

Hello All,

 

The Blog post might be quite old but still valid.

 

A new system property   has been introduced in regards to email sending, which should be taken into account:

glide.email.smtp.claim.lookback.hrs
Sets the default value of 24 hours. Any email older than 24 hours will not be sent by the system. This protects the system from having a huge number of sent emails at a time or if the outbox has a large number of emails waiting to be sent.

Set to a value greater than 24 (hours) and increase it in intervals to not send a large number of emails at one time. Depending on how big the backlog of emails is and how spaced out they are created in time, you might want to start with a value of 36 (1.5 days worth), let those go out, then set the value again to maybe 48 (two days), and keep increasing the value until all of the older emails are sent.

  • Type: integer
  • Value: 24

This is documented in https://www.servicenow.com/docs/bundle/washingtondc-platform-administration/page/administer/referenc...

 

Hope this Helps,

 

Gerrit Kuilder