Please help to resolve the below script

Dear Members,

Please help me to resolve below script. The script is used to send the attachment in the mail with all the details. However in one of the incidents, the attachment in the mail was blank. Now the client is after me to get it resolved ASAP. So prompt response would be highly appreciated. Please find the script below:-

if (condition ='Y') then  
  -- for sending the sumaary mail with reespect to abc_1 and xyz_1
l_write_line := '(echo To: '||recipient_list|| '; echo Subject: '||subject_line|| '; echo MIME-Version: 1.0; echo '||''''|| 'Content-Type: multipart/mixed; boundary="-q1w2e3r4t5"' ||'''' || '; echo; echo ' ||''''||'---q1w2e3r4t5'||'''' || '; echo Content-Type: text/html; echo Content-Disposition: inline; cat '||path_of_report|| '; echo '||'''' || '---q1w2e3r4t5' ||'''' || '; echo ' ||''''|| 'Content-Type: application; name="GEPI_AUDIT_SUMMARY_DETAILS.xls"'||'''' || '; echo Content-Type: text/html; echo ' ||''''|| 'Content-Disposition: attachment; filename="GEPI_AUDIT_SUMMARY_DETAILS.xls"'||''''|| '; cat '||path_where_report_will_be_attached|| '; echo '||''''||'---q1w2e3r4t5--'||''''||' ) | /usr/sbin/sendmail -t';
else 
  -- for just audit summary wrt movement name
l_write_line := '(echo To: '||recipient_list|| '; echo Subject: '||subject_line|| '; echo MIME-Version: 1.0; echo  Content-Type: text/html; echo Content-Disposition: inline; cat '||path_of_report|| '; ) | /usr/sbin/sendmail -t';

end if;

Thanking you in anticipation.

Regards,
SKO_TC

---------- Post updated at 10:02 AM ---------- Previous update was at 09:04 AM ----------

Dear Members,

It would be great if this gets resolved as early as possible. Please let me know if you want more details.

Regards,
SKO_TC

You stated that in one case the attachment was blank. You did not provide any details on data used to process this command. Further, it appears that your attachment is "hard-programmed" and thus, unusual to think that the attachment was blank.
Could the issue be something in the way the recipient's email is handling attachments? If only a problem for this one client, re-do your process keeping everything the same but direct that client's email to your own test email account - then you can verify whether blank or not.

1 Like

perhaps you should run

base64

on the xls file (mail is a 7-bit protocol and so a binary file such as an XLS should never be attached directly but rather the attachment should be

$(base64 $path_to_spreadsheet)
1 Like