Link to home
Start Free TrialLog in
Avatar of bhavanisharansingh
bhavanisharansinghFlag for India

asked on

Problem sending Email from Oracle(UTL_SMTP)

hi,
I am trying to send a mail from Oracle (UTL_SMTP).
Mail is getting sent, but Body of the email is ABSENT (Subject is present).
Code is as follows
BEGIN
      --Creating a connection with SMTP Server
      g_mail_conn := UTL_SMTP.open_connection (g_s_mailhost, 25);
      --Handshaking
      UTL_SMTP.helo (g_mail_conn, g_s_mailhost);
      --Setting the FROM ID
      UTL_SMTP.mail (g_mail_conn, p_i_msg_from);
      --Setting the TO ID
      UTL_SMTP.rcpt (g_mail_conn, p_i_msg_to);
      --Preparing the mail
      l_mesg :=
            'Date: '
         || TO_CHAR (SYSDATE, 'dd Mon yy hh24:mi:ss')
         || 'From: '
         || p_i_msg_from
         || UTL_TCP.crlf
         || 'To: '
         || p_i_msg_to
         || UTL_TCP.crlf
         || 'Subject: '
         || p_i_msg_subject
         || UTL_TCP.crlf
         || p_i_msg_text;
      --Setting the format of the mail as HTML
      UTL_SMTP.DATA (g_mail_conn,
                       'MIME-Version: 1.0'
                     || CHR (13)
                     || CHR (10)
                     || 'Content-type: text/html'
                     || CHR (13)
                     || CHR (10)
                     || l_mesg || CHR (13)
                    );
      --Closing the connection
      UTL_SMTP.quit (g_mail_conn);


There are some other procs also for sending mail.
They used to work fine earlier.
But now SMTP server is reconfigured for the machine.

Please help.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bhavanisharansingh

ASKER

Thats great. It worked buddy. Thanks a lot :).
Avatar of Sean Stuber
Sean Stuber

glad I could help, just accept the above answer and assign a grade to close the question
why only a B?  if it worked and was complete, it should have been an A.  

If you needed more, you only needed to ask.  Please don't assign penalties without giving the volunteers (not just me) a chance to complete your answer.