2016-07-06 9 views
1

Ich sende E-Mails über die Oracle-Datenbank über UTL_SMTP. Dies sind tägliche E-Mails, die automatisch versendet werden.Oracle UTL_STMP - kein Inhalt

Aber an manchen Tagen gibt es keinen Inhalt in der E-Mail und eine leere Mail wird gesendet.

Dies ist mein Code:

c := UTL_SMTP.OPEN_CONNECTION(sMailserver); 
UTL_SMTP.HELO(c, sMailserver); 
UTL_SMTP.MAIL(c, sFrom); 
UTL_SMTP.RCPT(c, sRecipients); 
UTL_SMTP.OPEN_DATA(c); 

UTL_SMTP.write_data(c, 'To: ' || sRecipients || UTL_TCP.crlf); 
UTL_SMTP.write_data(c, 'From: ' || sFrom || UTL_TCP.crlf); 
UTL_SMTP.write_data(c, 'Subject: ' || REPLACE(sDescr, '[DATE]',TO_CHAR(sDATE,'DD.MM.YYYY')) || UTL_TCP.crlf); 
UTL_SMTP.write_data(c, 'Content-Type: text/html;' || UTL_TCP.crlf); 

-- Write data  
UTL_SMTP.write_data(c, sData); 

UTL_SMTP.CLOSE_DATA(c); 
UTL_SMTP.QUIT(c); 

Antwort

1

Die Antwort war eine zusätzliche Zeile zwischen Kopfdaten und Körperdaten zu setzen:

UTL_SMTP.write_data(c, 'Content-Type: text/html;' || UTL_TCP.crlf); 

-- Extra line between header and body 
UTL_SMTP.write_data(c, UTL_TCP.crlf); 

-- Write data 
UTL_SMTP.write_data(c, sData);