Sending E-Mail from PL/SQL

I have used Oracle 9i (9.2.0.1) on windows Xp machine. I want to send e-mail
from PL/SQL procedure.
I execuete the procedure as follows friom SQL prompt in SCOTT user..
execute prc_send_mail('[email protected]','[email protected]','Test message');
before that I create the procedure in scott user and it is created successfully in scott user..
Procedue is as follows...
CREATE OR REPLACE PROCEDURE prc_send_mail (p_sender IN VARCHAR2,
p_recipient IN VARCHAR2,
p_message IN VARCHAR2)
as
l_mailhost VARCHAR2(255) := 'mail.yahoo.com';
l_mail_conn utl_smtp.connection;
BEGIN
l_mail_conn := utl_smtp.open_connection(l_mailhost, 25);
utl_smtp.helo(l_mail_conn, l_mailhost);
utl_smtp.mail(l_mail_conn, p_sender);
utl_smtp.rcpt(l_mail_conn, p_recipient);
utl_smtp.open_data(l_mail_conn );
utl_smtp.write_data(l_mail_conn, p_message);
utl_smtp.close_data(l_mail_conn );
utl_smtp.quit(l_mail_conn);
end;
unfortunately i have receiveed some error which I mentioned below...
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 17
ORA-06512: at "SYS.UTL_SMTP", line 96
ORA-06512: at "SYS.UTL_SMTP", line 138
ORA-06512: at "SCOTT.PRC_SEND_MAIL", line 9
ORA-06512: at line 1.
Please anyone giove me the solution..

> ORA-29278: SMTP transient error: 421 Service not available
Not an Oracle error. This is the SMTP server telling you to go and get stuffed. It does not want to talk to you.
See http://www.faqs.org/rfcs/rfc821.html.
The RFC says that this type of response code can be for example when the SMTP server is about to shutdown - thus informing the client that it cannot be serviced.
But seeing that you're trying to hijack mail.yahoo.com as your SMTP server.. I'm not surprise that the server is giving you the bird.

Similar Messages

  • How can i send a mail from pl/sql

    hi ...
    this is karthic....
    please help me in how to send the email from the pl/sql by using the procedure concepts..
    i need the query with explanations...

    Welcome to the forum.
    Your question has been asked earlier today.
    See the provided links in this thread as well:
    how to send mail through procedure

  • Send mail from PL/SQL with an attachment

    Hi,
    Can any body help me on how to send a mail from PL/SQL with an attachment which is located on a unix system path.
    This is an urgent requirement in my current project. Any quick reply would be greatly appreciated.
    Thanks
    Kumar.

    Quick reply (too bad you didn't mention your DB-version):
    Check the docs @ http://tahiti.oracle.com regarding packages UTL_SMTP and UTL_MAIL
    Check http://asktom.oracle.com/pls/asktom/asktom.search?p_string=%22mail+attachment%22
    Check http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
    Check http://www.oracle-base.com/articles/10g/PlsqlEnhancements10g.php#UTL_MAIL

  • Sending Mail from PL/SQL.

    Hi folks,
    I'm trying to send mail from PL/SQL (Database) with the help of UTL_SMTP.
    The pre-requisites for doing this are
    1) TCP/IP network.
    2) SMTP installation and accesibilty
    3) Oracle JServer installation.
    How do I check whether my database is having these three pre-requisites.
    Please bail me out from this problem.
    Your favour will be deeply appreciated.
    Cheers, PCZ.

    Hi,
    There nothing such prerequites, just u contact ur net admin team to relase your
    SMTP port in association with your empid id. and chk the port no 25 is also relased.
    And creating the procedure for sending mails. Refer the following link.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:1739411218448
    Cheers , Hope this will do
    Nirmal Kumar

  • Reg : Sending mails from PL/SQL

    Hello,
    I've written the following code for sending mails from PL/SQL.
    But the application gets hanged during compilation itself. Could
    any of u please tell me why it's happening and what is wrong in
    this and suggest me how to do it ??????
    CREATE OR REPLACE PROCEDURE SEND_MAIL
    IS
    msg_from varchar2(50) := '[email protected]';
    msg_to varchar2(50) := '[email protected]';
    msg_subject varchar2(100) := 'E-Mail message from your database';
    msg_text varchar2(1000) := '';
    c utl_tcp.connection;
    rc integer;
    BEGIN
    c := utl_tcp.open_connection('172.16.48.1', 80); -- open the
    SMTP
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'HELO localhost');
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'MAIL FROM: '||msg_from);
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'RCPT TO: '||msg_to);
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'DATA'); -- Start message body
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'Subject: '||msg_subject);
    rc := utl_tcp.write_line(c, '');
    rc := utl_tcp.write_line(c, msg_text);
    rc := utl_tcp.write_line(c, '.'); -- End of message body
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    rc := utl_tcp.write_line(c, 'QUIT');
    dbms_output.put_line(utl_tcp.get_line(c, TRUE));
    utl_tcp.close_connection(c); -- Close the connection
    EXCEPTION
    when others then
    raise_application_error(-20000,'Unable to send e-mail message
    from pl/sql');
    END;
    Awaiting for ur reply,
    Thanks in Advance...
    Srinivas

    FUNCTION Send_Mail ( sender IN VARCHAR2
         , recipient IN VARCHAR2
         , subject IN VARCHAR2
         , message IN VARCHAR2)
         RETURN BOOLEAN IS
         lv_mailhost VARCHAR2(30) := 'mailserver';
         l_mail_conn utl_smtp.connection;
         lv_crlf VARCHAR2(2):= CHR( 13 ) || CHR( 10 );
    BEGIN
         l_mail_conn := utl_smtp.open_connection ( lv_mailhost
              , 25);
         utl_smtp.helo ( l_mail_conn
                        , lv_mailhost);
         utl_smtp.mail ( l_mail_conn
                        , sender);
         utl_smtp.rcpt ( l_mail_conn
                        , recipient);
         utl_smtp.open_data (l_mail_conn);
         utl_smtp.write_data ( l_mail_conn
                                  , 'From: '
                                  || sender
                                  || lv_crlf);
         utl_smtp.write_data ( l_mail_conn
                                  , 'To: '
                                  || recipient
                                  || lv_crlf);
         utl_smtp.write_raw_data ( l_mail_conn
    utl_raw.cast_to_raw ( 'Subject:'
                        || subject
                        || lv_crlf));
         utl_smtp.write_raw_data ( l_mail_conn
    utl_raw.cast_to_raw ( lv_crlf
                        || message));
    utl_smtp.close_data(l_mail_conn);
         utl_smtp.quit(l_mail_conn);
         RETURN TRUE;
    EXCEPTION
         WHEN OTHERS
         THEN
              RETURN FALSE;
    END;

  • Send e-mail from web aplicattion, routine pl/sql generate by desginer

    Does anybody knows how send an e-mail from pl/sql routine, generate by designer on web aplicattion?

    This depend a lot on which OS Platform your Oracle is on.
    I have done it on Solaris, using UTL_FILE to create the mail and shell scripts.
    I have a cron-job (batch job) running 4 times pr. hour to look for and execute the generated scripts.
    If on NT I think it might be simpler, but you normally need a mail client running on your oracle server.
    Hope this helps,
    Jens

  • E72- Unable to send e-mail from work mailbox

    I am unable to send e-mails from my work e-mail through my E72 although it receives perfectly. I have been in contact with Nokia via e-mail for the last 2 weeks and they have sent several suggestions to solve the issue but nothing is working. I have set-up my work e-mail on my husbands Blackberry  with the same settings and can receive and send perfectly. From that I conclude there is no issue with the settings I have or my work e-mail but with
    Nokia!! The latest 'help' I have received was to download a patch but I have no idea how to do this and get it onto my phone. So far Nokia have not replied to me.
    Any suggestions how to get this to work would be greatly appreciated

    If you're using a much older firmware, updating the phone would be a good idea.  Find the Software Updates section of nokia.com and type your phone model.  If you can't do an over-the-air update, download and install either the OVI Suite or the standalone Software Updater.  This may hard reset the phone, so back up anything important with OVI Suite first.
    Ignoring firmware for now, IMAP and URL's are like apples and oranges.  If you work for a small company, the server may always be called " mail.mycompany.com", but IMAP will never use an HTTP or HTTPS prefix.  URL's are typically associated with Microsoft Exchange servers.  Within the email program, check Options -> Settings -> Mailbox settings -> Mailbox settings -> Advanced mailbox settings.  Are "Outgoing email settings" set to something like
    User authentication: Same as for incoming
    Outgoing mail server: <compare to the setting for the Incoming server name; in a small company this will likely be the same>
    Since you're getting far enough for the mail sever to reject your connection, the other settings should be fine as-is.
    It does look like an authentication issue, so I'd say you're either hitting the wrong server or there's a bad username or password in there somewhere.  If the Blackberry works with an IMAP connection, then you should be using the same server name(s), and user/password.
    If all else fails, you can always try removing and readding the mailbox completely.  Choose Menu -> Applications -> Email -> Settings -> <highlight your work account> -> Options -> Remove mailbox.  And then set it up from scratch.  I hope that helps a little!

  • Why can I not send e-mails from my e-mail account? I can receive e-mails. Not an iCloud account. It is a Bell Aliant account.

    Why can I not send e-mails from my e-mail account? I can receive e-mails. It is not an iCloud account it is a Bell Aliant account. An account I pay for.
    This is the second time in three months this has occurred. Bell Aliant suggested I contact Apple directly as the only option is to remove my e-mail account and reconfigure it. This will mean losing all my files. These files are very important as my account is a business account.
    Bell Aliant thought perhaps it is an Apple problem and that Apple may better be able to remedy the situation without me losing my e-mail files.

    Sorry ?
    An Internet email provider losses all your Mail and it's Apple's fault ??
    Did they explain how the app managed to delete all of your mail and then not even let you have access ?
    If that was the case the app should still be able to access the empty folders.
    I know there is often blame and counter blame in these situations but there are limits.
    9:50 pm      Friday; April 10, 2015
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Can not send e-mails from account but can receive

    I have my e-mail account with ATT Yahoo.
    I received an account verification notice yesterday from ATT and I responded and they said I was verified.
    However after I did that I could not send e-mails from my Imac desktop but I am receiving them.
    I spend 4 and a half hours, yes 41/2 hours with both Apple Care and ATT and they could not correct the problem. Both discussions were with upper tier support personnel.
    Here are some facts that make this an odd issue:
    (1)
    I have other e-mail boxes from ATT and they can send and receive e-mails.
    (2)
    MY laptop can still send and receive e-mails from the e-mail account that is only receiving with my Imac.
    (3)
    All the settings are exactly the same and both Apple Care and ATT checked them.
    Is there anybody out there that may have an answer ?
    Both Apple Care and ATT blamed each other.
    My concern is that today I received another e-mail trying to verify my e-mail address for another e-mail address from ATT.
    I called ATT and they did not know why, I DID NOT open it up and trashed it.
    ATT has put a filter on my other e-mail accounts and hopefully that will end any problems with them.
    The account that has the issue is my main account and I cannot trust leaving it and am trying to avoid having to change it.
    Greg

    Hi Rachel, For what it will be worth, I was like a dog with a bone about this, so I decided to give it another go. I have success on both boxes. Here is what I did, I warn you now it was a lengthy process. Before you begin download all the upgrade steps from X.5.0 to X.5.6 as single stages ( for me the combo's did not work) and have them ready to use.
    1st Backup all your mail to CD/DVD not on the box. Check for any unsent mails anywhere in the box and then throw out all of the mail bits that are anywhere on the system in any folder. 2nd Install & Archive, 3rd Start up from Install DVD and check/set permissions, reboot. Enter all your ISP details to mail, see if you can send a mail to yourself. If not dump all the mail you tried and the .plists, reboot and install next update in the series, enter all details as before, try and send etc. If this fails dump again and reboot install next update etc.
    I started at X.5.1 and got to vX.5.4 before I got a result in that sys asked me if this server will do, I said yes and I got mail out. The server name was different that was offered but when all was over it showed as the correct one that it should be on port 995. I must add that I had the spinning cog wheel for quite some minutes before anything happened. I continued on this way for the rest of the updates. 1x1 until v.6 was reached. That was only on the G4, I now had to do it all again on the MacPro. This one was not so co-operative in that I had to do it twice, but now it also has Mail running. It is funny though that I had to reach X.5.4 on both machines before it came right. On the G4 I was using a retail disc and on the Intel the supplied for discs.
    Others on here may have a better and quicker way, but for me this did work. I am sure that there is a problem in either the mail app itself or the production of the Master DVD's.
    Whatever, good luck.

  • Sending a mail from oracle database

    Hi,
    I have a requirement to send a mail from oracle database.I use UTL_TCP package for this.Although my procedure is executed successfully,i dont get the mails in my inbox.Please help me to figure out a solution.
    Thanks in advance....

    Hi, you must use UTL_SMTP package for send emails, it has more performance and features for debug. You must look the next code, this is a example for send emails.
    DECLARE
    c UTL_SMTP.CONNECTION;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP.WRITE_DATA(c, name || ': ' || header || UTL_TCP.CRLF);
    END;
    BEGIN
    c := UTL_SMTP.OPEN_CONNECTION('smtp-server.acme.com');
    UTL_SMTP.HELO(c, 'foo.com');
    UTL_SMTP.MAIL(c, '[email protected]');
    UTL_SMTP.RCPT(c, '[email protected]');
    UTL_SMTP.OPEN_DATA(c);
    send_header('From', '"Sender" <[email protected]>');
    send_header('To', '"Recipient" <[email protected]>');
    send_header('Subject', 'Hello');
    UTL_SMTP.WRITE_DATA(c, UTL_TCP.CRLF || 'Hello, world!');
    UTL_SMTP.CLOSE_DATA(c);
    UTL_SMTP.QUIT(c);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    BEGIN
    UTL_SMTP.QUIT(c);
    EXCEPTION
    WHEN UTL_SMTP.TRANSIENT_ERROR OR UTL_SMTP.PERMANENT_ERROR THEN
    NULL; -- When the SMTP server is down or unavailable, we don't have
    -- a connection to the server. The QUIT call will raise an
    -- exception that we can ignore.
    END;
    raise_application_error(-20000,
    'Failed to send mail due to the following error: ' || sqlerrm);
    END;
    Also review the next link for get more information about the UTL_SMTP packege.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_smtp.htm#sthref15587
    Regards.

  • How do I set up my 3G to send/receive mail from MS exchange?

    How do I set up my 3G to send/receive mail from MS exchange?

    Welcome to the Apple Community.
    If you can't get your mail to work on Snow Leopard after June 30, you might want to try one of these approaches
    1. Configuring Mail in Snow Leopard
    2. Delete your mail account from Mail preferences and set it up again using the Mail Server Information.
    Some users have apparently encountered issues using this information in pre-Lion set ups (I haven't), Roger Wilmut has kindly provided instructions for those who find themselves with this problem.
    Entering iCloud email settings manually in Snow Leopard or Leopard

  • Why am I unable to send e mails from my IPhone or IPad and get message rejected from outgoing server, message placed in outbox

    Why am I unable to send e mails from my iPhone, and get message rejected by server and message put in outbox.  I have tried changing server ports but to no avail.  I am not very technically minded so any suggestions in laymans terms please.  This is a big problem as I work away frequently and need to answer e mails.  This also happens when at home and on my own wifi.

    Hey Pam3008
    The article below will give some troubleshooting steps to resolve Mail issues.
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • How to Send a Mail From the Oracle Applications.

    Hi,
    I was assigned a task to send a mail from the front end i.e., from oracle applications.
    but i have no idea.
    i am working on oracle apps R12.1.1 and 10g reports.
    First i have to create an rdf file and that rdf file i want to send as an attachment through mail from the apps.
    Any Advice will be of great help and i will follow accordingly.
    Thanks in Advance,
    Regards,
    Bharathi.S

    Hi,
    I was assigned a task to send a mail from the front end i.e., from oracle applications.
    but i have no idea.
    i am working on oracle apps R12.1.1 and 10g reports.
    First i have to create an rdf file and that rdf file i want to send as an attachment through mail from the apps.
    Any Advice will be of great help and i will follow accordingly.
    Thanks in Advance,
    Regards,
    Bharathi.S

  • When I send out mail from MS Outlook enterprise account in the office to my Mac at home they are received as "winmail.dat" files.  Even if I perform a "save as" to the correct file name the file format is still not recognized.  Why is this happening!?

    When I send out mail from MS Outlook enterprise account in the office to my Mac at home they are received as "winmail.dat" files.  Even if I perform a "save as" to the correct file name the file format is still not recognized.  Why is this happening!?

    http://www.joshjacob.com/mac-development/tnef.php

  • When I send a mail from my iPhone, it displays the mail server name to the receiver if the mail and does nog display my name or e mail address. This only since upgrading my iPhone5 to iOS7

    When I send a mail from my iPhone, it displays the mail server name to the receiver if the mail and does not display my name or e mail address. This only since upgrading my iPhone5 to iOS7. I've checked all settings etc. anyone have a solution please?

    Rectory wrote:
    Please can someone tell me how  I can change this so when I send a mail from my phone and from the IPad that it reads from me.
    You need a separate email address but you've already ruled out that solution.

Maybe you are looking for

  • How to modify Adapter parameters in PI 7.1 EHP1 ? using NWA

    Hi, Please advise me how to modify adapter service parameters in PI 7.1 EHP1 using nwa ? in the previous version 3.0 and 7.0, i can use visual admin ---> cluser - > services and i can find all the adapter service and modify the parameters. Thank You

  • Bug Fixes in CS5

    Does anyone know where a list of CS5 bug fixes are?  The new features sound nice, but I'm very interested in finding out if the things I experienced in CS4 that did not work are resolved.  I had DV-AVI files from a client that were layered along with

  • Invoice in past date(2008)

    Hi, We have a shipment cost document & the subsequent documents is invoice receipt document but the problem is that shipment cost document is dated 17-05-2010 but the subsequent invoice receipt document is of 18-02-2008. Can anyone tell what can be t

  • Colors fade on export

    I've been using Aperture for over a year and have never noticed this problem before. I was editing some photos today and choose "Edit with Photoshop", and when the image opened in PS the colours were noticeably desaturated. I had only applied a small

  • IPod classic as Backup

    i would like to use my iPod Classic as an external hard drive to back up my camera SD card.  I have an Apple SD to 30 pin adaptor used to transfer photos to my iPad, but  the iPod won't accept the photo files from theSD.  Is there a way to make it wo