Mail retrieval - how to do it using PL/SQL

Hi,
I want to automatically pull emails on daily bases and store it in a table... how to do it...?
Please advice
Thanks in advance

qwe12654 wrote:
I want to automatically pull emails on daily bases and store it in a table... how to do it...?There are 2 application protocols for reading e-mails from a mailbox. The POP3 (Post Office Protocol v3) and IMAP (Internet Message Access Protocol) protocols. There are also proprietary ones (like used by Microsoft Exchange).
POP3 is however the most common one. Like SMTP it is clear text and relatively easy to use. Unlike SMTP, Oracle does not supply a UTL_SMTP package for it. So you need to use UTL_TCP directly in order to create a client socket for communicating with the mailbox.
Some years ago I posted a very basic example of interacting with a POP3 mailbox using a pipeline table function. See {message:id=2018101} for the source code.
This does POP3 authentication and using the RETR (retrieve) command to fetch an e-mail from the mailbox. Adding additional commands to list the number of mails in the mailbox and delete them after retrieval, should not be a problem.
The POP3 protocol specification is detailed in RFC 1939.

Similar Messages

  • How to send email using pl/sql containing the result set as the msg body

    Hi.. im using Pl/SQL code to send emails to the users from a dataset that is obtained in a databse table. i have used utl_smtp commands to establish the connection with the smtp mail server. im stuck at the logic when i have to include the message body which is actually the result set of a table.. For instance
    IF (p_message = 0) THEN
    UTL_SMTP.write_data(l_mail_conn, 'There is no mismatch between the codes' || UTL_TCP.crlf);
    ELSE
    UTL_SMTP.write_data(l_mail_conn, 'The missing codes are ' || UTL_TCP.crlf);
    for s in (select * from temp)
    loop
    UTL_SMTP.write_data(l_mail_conn, ' ' ||s || UTL_TCP.crlf);
    end loop;
    END IF;
    UTL_SMTP.close_data(l_mail_conn);
    UTL_SMTP.quit(l_mail_conn);
    END;
    ***p_message is a prameter passed to this procedure..
    Can i obtain the result in the form i have it in my table. which has three columns. I want to display the three columns as it is with teh records. ?

    this is not related about this forum but you can use below,
    CREATE OR REPLACE PROCEDURE SEND_MAIL (subject varchar2,mail_from varchar2, mail_to varchar2,mail_msg varchar2)
    IS
    mail_host varchar2(30):='XXXXX';
    mail_conn utl_smtp.connection;
    tz_offset number:=0;
    str varchar2(32000);
    BEGIN
    begin
    select to_number(replace(dbtimezone,':00'))/24 into tz_offset from dual;
    exception
    when others then
    null;
    end;
    mail_conn:=utl_smtp.open_connection(mail_host, 25);
    utl_smtp.helo(mail_conn,mail_host);
    utl_smtp.mail(mail_conn,'[email protected]');
    utl_smtp.rcpt(mail_conn,mail_to);
    utl_smtp.open_data(mail_conn);
    utl_smtp.write_data(mail_conn,'Date: '||to_char(sysdate-tz_offset,'dd mon yy hh24:mi:ss')||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'From: '|| mail_from ||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'To: "'|| mail_to ||'" <'||mail_to||'>'||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,'Subject: '||subject||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,replace_turkish_chars(mail_msg)||utl_tcp.crlf);
    utl_smtp.write_data(mail_conn,utl_tcp.crlf);
    utl_smtp.close_data(mail_conn);
    utl_smtp.quit(mail_conn);
    END;
    Edited by: odilibrary.com on Jun 12, 2012 5:26 PM

  • How to process validations using PL/SQL function

    Hi.
    I created a page with a form to process DML operations against a database table. Also created a validation using PL/SQL function that returns a boolean value:
    declare
    v_dummy varchar2(1)
    begin
    select 'X'
    into v_dummy
    from s_customer
    where id = :p2_id;
    return (TRUE);
    exception
    when no_data_found then
    return (FALSE);
    when others
    return (TRUE);
    end;
    In this case i want to send a message to the user indicating that an certain row (the one with :p2_id value) already exists in the database. The piece of code above will do the job. If this function returns true, it means the row is in the DB already.
    The problem is that i don´t know what do to or how to tell htmldb that a TRUE value should issue a message or be processed as en error, whilst a FALSE means OK.
    How do i tell htmldb what to do?
    Suppose must do something with "expression 1" , "expression 2", etc.
    Any ideas???

    Hóla LuÃs,
    when you pick the PL/SQL function body returning a boolean, it implicitly means that TRUE means OK, while FALSE means error, always.
    In order to associate such error to a given form field, you have to go back to the page definiton / validations and specify the name of the item in the corresponding field.
    When you first create the validation rule, this value is not present even if you ask for the error message inline with the field.
    The error message text can be specified in the validation definition, if I am not wrong.
    When you need to return special error messages, including dynamic content for instance, you can use the Function Returning Error Message type, which reports an error when the string returned by the function is not null. This comes in handy when you want to display an item's code, for example, rather than generic text.
    Even in this case, you must go back to the validation and specify the name of the field if you want to see it inline.
    Hope it helps,
    Flavio

  • Capture mail with Attachment from POP server using PL/SQL

    Hey guys,
    With the help of this forum and Billy I am able to capture the email from POP3 server and display it to the user. But my query is how can I get an Attachment from the email using PL/SQL's UTL-TCP method ? Right now it displays some encrypted code.
    Thanks.

    Hey guys,
    With the help of this forum and Billy I am able to capture the email from POP3 server and display it to the user. But my query is how can I get an Attachment from the email using PL/SQL's UTL-TCP method ? Right now it displays some encrypted code.
    Thanks.

  • How to update by using PL/SQL Records

    Hi,
    I want to update EMP table columns ename and empno only
    from other existing table TEST_EMP
    EMP table contains 14 rows.TEST_EMP table contains 3 rows.
    I need to update first three rows in EMP table.
    TEST_EMP DATA IS:
    ENAME EMPNO
    E1 1001
    E2 1002
    E3 1003
    Following code i written to update EMP table.
    DECLARE
    type r is record(id emp.empno%type,
         name emp.ename%type);
    r1 r;          
    BEGIN
    select ename,empno into r1 from test_emp;
    FOR i IN r1.FIRST .. r1.LAST
    LOOP
    update emp2
    set ename=r1(i).ename,
    empno=r1(i).empno
    WHERE empno = l_rc (i).empno;
    end loop;
    commit;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (SQLERRM (SQLCODE));
    END;
    ERROR OCCURRED:
    ORA-06550: line 9, column 14:
    PLS-00302: component 'FIRST' must be declared
    ORA-06550: line 9, column 2:
    PL/SQL: Statement ignored
    I should use PL/SQL Record to update Table This is Mandatory.
    pls guide me.
    Regards,
    Venkat.

    > I want to update EMP table columns ename and empno only
    from other existing table TEST_EMP
    Why use PL/SQL and why use cursors?
    You are running a SELECT on the source table via the SQL engine and pulling that data from the db buffer cache into PL/SQL variables.
    Then you take that very same data, and push that back to the SQL engine using an UPDATE.
    So if you need to update 10KB worth of data, it means pulling 10KB from the SQL engine into the PL engine.. and then pushing 10KB of data from the PL engine back to the SQL engine.
    Not only pushing and pulling - you need your code to switch continually between the PL and SQL engines to do this.
    Now imagine doing it for 10MB of data.. or 1GB of data.. or more.
    Does it sound like your approach is effective? Does it sounds like it will perform well? Does it sound like it will scale?
    The basic rule for Oracle development is:
    Maximize SQL. Minimize PL/SQL (or Java or C#, etc).

  • How to connect database using oracle SQL developer

    Hello
    I am newbie in EBS R12
    I downloaded Oracle SQL Developer
    and create new database conenction
    Connection name: ebs demo db connection
    username:
    password:
    Role: Default
    Connection type: Basic
    Hostname: ebstailin.demo.com
    Port: 1521
    SID: clone
    when i try this there is an error
    Status: Failure-Test failed: lo exception: The Network Adapter could not establish the connection
    no idea about this
    but i used the apps/apps as username and password
    please help
    thanks
    Edited by: cheesewizz on Jul 16, 2010 11:35 PM

    Hello
    Thanks for your reply
    I tried to connect and here is the result: see below
    [oracle@ebstailin 11.1.0]$ sqlplus / as sysdba
    SQL*Plus: Release 11.1.0.7.0 - Production on Sat Jul 17 15:35:31 2010
    Copyright (c) 1982, 2008, Oracle. All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> CONNECT apps/apps
    Connected.
    SQL>
    But still cannot connect using ORACLE SQL Developer
    thanks

  • How to connect sqlserver use oracle sql developer?

    I created a non-oracle location connection in owb and can load data from sqlserver to warehouse. Now, I want to use sqlplus or sqldeveloper to connect sqlserver directly, But I got this error message"ora-03135:connection lost contact".
    How can I connect sqlserver in sqldeveloper or sqlplus?
    Thanks

    Hi Napo,
    SQLDeveloper can migrate to oracle, browse sqlserver and run and display results from single statements.
    I have not seen "ora-03135:connection lost contact" have you set up sqlserver for tcp/ip connection, checked the port is open (and not blocked by, for example, firewalls) and used the jtds driver to connect SQLDeveloper to sqlserver?
    Note that "ora-03135:connection lost contact" is an oracle error and does not seem related to sqlserver.
    Oracle also has heterogenous gateway products which may be useful
    Oracle® Database Gateway for SQL Server User's Guide
    http://download.oracle.com/docs/cd/B28359_01/gateways.111/b31049/toc.htm
    -Turloch

  • How to set ORACLE_HOME used by SQL Developer?

    I need to use OCI/Thick driver with SQL Developer to get OS authentication working. I have 64-bit windows and 64-bit oracle installed. I also have 32-bit instant client in another ORACLE_HOME, because the libs of 64-bit ORACLE_HOME won't work with SQL Developer. Quite trivial setup if the SQL Developer would just take the hint an start using the right ORACLE_HOME. I have tried making a start.bat containing following...
    set ORACLE_HOME=C:\oracle\product\11.1.0\instantclient_11_1
    start sqldeveloper.exe
    ..but it doesn't have any effect. I can't change ORACLE_HOME in registry, because it would mess up other services requiring 64-bit oracle.

    It might be a little late for the original post, but maybe someone else will need it:
    I found that the way to solve such issue is by specifying the TNSNAMES of the wanted oracle_home. That'll do it.
    It could be done in Tools -> Preferences -> Database -> Advanced -> Tnsnames directory.
    Screenshot:
    http://i40.tinypic.com/2nk2rs4.png
    Tested on Oracle SQL Developer 3.2.20.09 and 4.0.0.12

  • How create tabular form using dynamic sql

    I have 50 tables and I need create application for support all these tables, I don't want to create 50 tubular regions.
    I want create list of tables; user pick one of them and I want generate dynamic tabular form for suppot.
    Is it possible?
    Thanks Mary

    Hi Mary,
    It is possible, but you would have to control everything manually. Have a look at: [http://apex.oracle.com/pls/otn/f?p=33642:252] - I've included instructions explaining how this has been created
    Andy

  • How to use PL/SQL & Forms6i for a logon screen

    i am new user to oracle. just wanna now how to create a user logon screen using SQL and Forms6i. well, i have created a table for logon with data item of username and password. in the form, i hava successfully created the data blocks but i don't know how to link them using PL/SQL or triggers or etc.
    ur concern will be very grateful. TQ.

    Hi MatrixMan
    Just create button and write the follwing inside
    trigger when_button_pressed :\
    begin
    logout;
    LOGON(:USER_NAME,:PASSWORD );
    IF FORM_SUCCESS THEN
    MESSAGE('Login Successful');
    MESSAGE('Login Successful');
    ELSE
    MESSAGE('Check username or password');
    MESSAGE('Check username or password');
    GO_ITEM('USER_NAME');
    :USER_NAME:=NULL;
    :PASSWORD:=NULL;
    END IF;
    end;
    Thanks
    Mohammed Al-shake

  • How to backup/restore credentials in sql server 2012

    Hi, Can any one direct how to restore credentials using T-sql or GUI on SQL Server 2012.
    As per BOL, we know how to create credentials. 
    http://msdn.microsoft.com/en-us/library/ms189522.
    But looking for taking backup/restore credentials sql serve 2012.
    Thanks

    Hi,
    I highly recommend to go from step 1 to the end in this tutorial, but if you realy want to just only to restore than you can start in Lesson 4: Perform a Restore From a Full Database Backup
    http://msdn.microsoft.com/en-us/library/jj852091(v=sql.110).aspx
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • I set up an apple ID with an invalid e-mail address, how can I change it because I can't retrieve the e-mail to complete the account process

    I set up an Apple ID with an invalid e-mail address, how can I change the e-mail address without completing the process of creating the ID cause I can't retrieve the e-mail to complete the process.

    Try changing the email address using https://appleid.apple.com/
    If you can't change it with that site, you'll have to create a new account.

  • How do I start using my mac mail account on my ipad?

    How do I start using my mac mail account in my ipad?

    No error messages or anything? If your OE is still running and is using POP, there won't be any email for you to retrieve with your iPad because OE has downloaded the email to your computer. To sync email between your computer and your iPad you need to use IMAP settings on both your computer and iPad, not POP.

  • How can I setup a mail-specific passcode/restriction on iPad used by multiple family members?

    How can I setup a mail-specific passcode/restriction on iPad used by multiple family members?
    Have an Exchange mail account setup and accessible in my mail on iPad... however my kids use it and i would like to restrict them from accessing this specific portion of the device.  I tried viewing restriction options and do not see that i can apply a restriction specifically to Mail.  Thanks for your help.

    Not a feature of iOS. Check the AppStore to see if there are other
    mail apps that allow passcode protection.
    Or use Safari to log onto your email via a web-based interface and
    enter your credentials each time. A bit slower, but the kids will
    not know the details to login.

  • I used #004# to deactivate my iphone 4s voice mail.  How do I get it back on?

    I used #004# to deactivate my iphone 4s voice mail.  How do I get it back on?

    contact your carrier

Maybe you are looking for

  • Vendor Invoices

    Could you please let me know where can I find the Vendor Invoice details in ECC ? I mean Tables and extractor name . Regards

  • How to create page tabs in Numbers

    I am trying to create Tabs for 12 pages in the same document for numbers. These tabs that I would like to create are what I am used to on Excel and you can have one document with seperate tabs at the bottom. Not sure if numbers can do this?

  • Setting up Time Capsule and external hard drive

    Hi, In the past i've been using Time Machine for backing up all my data from my Mac Book Pro to a 120GB lacie external hard drive. I've now purchased a Time Capsule and want to know the best way to transfer my backup data from the External HD to my T

  • How to Map Java Beans to appropiate ActionScript class ??

    Hi I find it  difficulty in writing a ActionScript class for java Bean. Is there any automation  tool avialable which will generate an ActionScript class basing on the java Bean ?? Thanks in advance .

  • Compressing pdf's and keep image quality for email send outs

    Hello I have a 55MB Pdf file which I would like to compress to be compatible with email send outs. I work a lot with imagery and need my visuals to be crisp and sharp. Anyone clued up on what settings to use to keep the best possible image quality? W