Tuesday, December 27, 2016

UTL_SMTP: Random Exclamations

Recently I noticed an issue with random exclamations points(!) in the HTML email notification, generated using UTL_SMTP package in PLSQL.

These random exclamations points were not supposed to be part of the message, but strangely appears in the message body. After analyzing for some time, I found out the cause. Here is my analysis.


Cause:
This issue appears only with HTML email notification exceeding 1000 characters(includes the CR and LF) per line. As per RFC#2822 Section 2.1.1, no line can be longer than 998 characters without a line break.


Fix:
Solution is simple. Concatenate each line with CHR(10) or line breaks, so that each line will not exceed 1000 characters mark.

No comments:

Post a Comment

Provide your thoughts !