0

I am writing a code which sends mail but it does not display any details over my mail

A blank mail is sent without any SUBJECT , BODY

Code :

CREATE OR REPLACE PROCEDURE MAIL_ME 
(
    v_frm in VARCHAR2,
    v_msg in VARCHAR2,
    v_smtp_hst in VARCHAR2,
    v_smtp_prt in NUMBER DEFAULT 88
)
AS
   m_conn UTL_SMTP.connection;
BEGIN
   m_conn : = UTL_SMTP.open_connection(v_smtp_hst,v_smtp_prt);
   UTL_SMTP.helo(m_conn,v_smtp_hst); 
   UTL_SMTP.mail(m_conn,v_frm);
   UTL_SMTP.rcpt(m_conn,v_to);
   UTL_SMTP.data(m_conn,v_msg || UTL_TCP.crlf || UTL_TCP.crlf);
   UTL_SMTP.quit(m_conn);
END;
/

Calling :

BEGIN
   MAIL_ME(
   v_to => 'abc@protonmail.com',
   v_frm => 'xyz@protonmail.com'
   v_msg => 'Hi Buddy!!!'
   v_smtp_hst => 'PROTONMAIL.mtp.com' 
   );

END;
/

The mail is sent but no details shown over mail

 Subject , Body is missing in mail sent 
kiric8494
  • 195
  • 1
  • 7
  • 3
    You’ve tagged APEX, why not use apex_mail instead (which will be doing all the right calls to utl_smtp)? If you want to use utl_smtp then try giving the email some headers - it looks like your email client isn’t happy with just having data, the multiline example on oracle-base is probably what you’re after https://oracle-base.com/articles/misc/email-from-oracle-plsql#multiline – Andrew Sayer May 28 '22 at 13:35
  • 1
    Even UTL_MAIL would be a reasonable choice if you don't want to have to learn too much about the SMTP protocol. Of course, if you're doing this in an APEX session then APEX_MAIL would be the best choice. – Jeffrey Kemp May 30 '22 at 08:44

0 Answers0