This discussion is archived
4 Replies Latest reply: Jan 21, 2013 12:17 AM by 972094 RSS

Not Seeing Content of E-mail

972094 Newbie
Currently Being Moderated
mail send successfully but not display the text of e-mail in message body
the code is given below

thanks in advance..!!





create or replace procedure SEND_GREETING_EMAIL
(
mailhost IN VARCHAR2 default 'host_address',
sender IN VARCHAR2 default 'no-reply@a.com',
Cc IN varchar2 default 'p@a.com',
recipient IN varchar2 default 'j@n.com',
crlf VARCHAR2 default chr(13)||chr(10),

v_subject IN VARCHAR2 default '***Happy Birthday***'

)
is
mail_conn UTL_SMTP.CONNECTION;
p_message_a varchar2(4000);






BEGIN

dbms_output.put_line(p_message_a);


p_message_a:= '<html>
<body style="background-color:PowderBlue;">
<h1> Hi!</h1>
<h3>Greetings from Greaves Family!!</h3>
<p style="font-family:CenturyGothic;color:red;">
Wish You Happy Birthday </p>
<p style="font-family:CenturyGothic;color:green;">
All Your Wish May Come true...</p>
<p class="ex1">From:-HR Aurangabad...!!</p>
</body>
</html>';

mail_conn:= UTL_SMTP.OPEN_CONNECTION(mailhost, 25);

utl_smtp.Helo(mail_conn, MailHost);
utl_smtp.Mail(mail_conn, sender);
utl_smtp.Rcpt(mail_conn, recipient);
utl_smtp.Rcpt(mail_conn,Cc);
utl_smtp.Data(mail_conn,
'From: ' || sender || crlf||
'Subject: '|| v_Subject|| crlf||
'To: ' || recipient || crlf||
'Cc: ' || Cc || crlf ||
'Content-Type: '||'text/html;charset=us-ascii' || crlf||
crlf||
---- 'some message text'|| crlf || -- Message body
p_message_a|| crlf
);
utl_smtp.Quit(mail_conn);

END;

Edited by: 969091 on Jan 18, 2013 10:47 PM

Edited by: 969091 on Jan 20, 2013 9:57 PM
  • 1. Re: Not Seeing Content of E-mail
    KPR Journeyer
    Currently Being Moderated
    Hi

    Try like this....!!!
    declare
    v_from varchar2(80) := 'johnpeter@hp.com;
    v_Recipient VARCHAR2(120) := 'johntravolta@hp.com';
    v_subject varchar2(80) := 'test';
    v_Mail_Host VARCHAR2(100) := 'abckdkosjflsjwojljco@.ljljlkj';-- IP of email server
    v_Mail_Conn utl_smtp.Connection;
    crlf VARCHAR2(2) := chr(13)||chr(10);
    v_dt VARCHAR2(30):=to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss');
    BEGIN
    v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
    utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
    utl_smtp.Mail(v_Mail_Conn, v_From);
    utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
    utl_smtp.Data(v_Mail_Conn,
    'Date: ' || v_dt || crlf ||
    'From: ' || v_From || crlf ||
    'Subject: '|| v_Subject || crlf ||
    'To: ' || v_Recipient || crlf ||
    crlf ||
    'some message text'|| crlf || -- Message body
    'more message text'|| crlf
    );
    utl_smtp.Quit(v_mail_conn);
    EXCEPTION
    WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
    raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    end;
    Just your junk mail also...sometimes it will go your junk mail.

    Regards
    KPR
  • 2. Re: Not Seeing Content of E-mail
    972094 Newbie
    Currently Being Moderated
    u r right but mail goes in junk and no content is to seen by receipient


    help me please
  • 3. Re: Not Seeing Content of E-mail
    KPR Journeyer
    Currently Being Moderated
    Hi

    write something text like your name at 'some text here / more text here' in my code...then run the script...let us see...!!!

    KPR
  • 4. Re: Not Seeing Content of E-mail
    972094 Newbie
    Currently Being Moderated
    Thanks for advise but i already done procedure for and i does not want to write anything else without procedure so is there any solution..??


    Thanks in advance
    Suggest me...!!!!

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points