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.

Similar Messages

  • Send mail with attachment from the uploaded file

    hi,
    From a form thread i got the following code to send mail with attachment with the file uploaded from the file upload ui element.
    public void onActionLoadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionLoadFile(ServerEvent)
         WDWebResourceType FileType = null;
         String FileName = new String();
              //get attribute info for context attribute 'FileUpload'
              IWDAttributeInfo attributeInfo =
                   wdContext.getNodeInfo().getAttribute(
                        IPrivateEmailView.IContextElement.FILE_UPLOAD);
              //get modifiable binary type from the attribute info,requires type cast.
              IWDModifiableBinaryType binaryType =
                   (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();
              IPrivateEmailView.IContextElement element =
                   wdContext.currentContextElement();
              //if a file in the 'FileResource' attribute exists
              if (element.getFileUpload() != null) {
                   try {
                        String mimeType = binaryType.getMimeType().toString();
                        byte[] file = element.getFileUpload();
                        //get the size of the uploaded file
                        element.setFileSize(this.getFileSize(file));
                        //get the extension of the uploaded file
                        element.setFileExtension(binaryType.getMimeType().getFileExtension());
                        //NOTE: context attribute 'FileName' must not be set
                        //because the FileUpload-UI-element property 'fileName'
                        //is bound to it. Consequently the fileName is automatically
                        //written to the context after file upload.
                        //report success message
                        wdComponentAPI.getMessageManager().reportMessage(
                        IMessageEmailComp.SF_UPLOAD,
                             new Object[] { binaryType.getFileName()},
                             false);
                        FileType = binaryType.getMimeType();
                        FileName = binaryType.getFileName();
                   } catch (Exception e) {
                        throw new WDRuntimeException(e);
              //if no file in the 'FileResource' attribute exists
              else {
                   //report error message
                   IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
                   msgMgr.reportContextAttributeMessage(
                        element,
                        attributeInfo,
                        IMessageEmailComp.NO_FILE,
                        new Object[] { "" },
                        true);
              //clear the FileResource context value attribute
              //element.setFileUpload(null);
              String URL;
              URL = this.CreateAndGetPathFileUpload(
                                  wdContext.currentContextElement().getFileUpload(),
                                                      FileName);
    //          if (URL.length() == 1){
    //               //ERRORE
         wdContext.currentContextElement().setPATHFileUploaded(URL);
        //@@end
      public boolean send( java.lang.String subj, java.lang.String mess, java.lang.String dest, java.lang.String attach, java.lang.String FileName )
        //@@begin send()
         InitialContext ctx = null;
         Address[] address = null;
         Message msg = null;
         Session sess = null;
         MimeBodyPart bodyPart = null;
         Multipart mp = null;
         // "141.29.193.71" == milvl2ja.icn.siemens.it (SMTP di Siemens)
           try {
              Properties props = new Properties();
              props.put("domain","true");
              ctx = new InitialContext(props);
              sess = (Session) ctx.lookup("java:comp/env/mail/MailSession");
              msg = new MimeMessage(sess);
              IWDClientUser utente = WDClientUser.getCurrentUser();
              String senderEmail = utente.getSAPUser().getEmail();
              InternetAddress addressFrom = new InternetAddress(senderEmail);
              msg.setFrom(addressFrom);     
              String EmailDEST = dest;
              InternetAddress addressTo = new InternetAddress(EmailDEST);
              msg.setRecipient(Message.RecipientType.TO, addressTo);
              msg.setSubject(subj);
    //          if ((mess != null) && (mess.length()>0)) {
    //                 msg.setContent(mess, "text/plain");
    //            } else {
    //                 msg.setContent("", "text/plain");
              //Gestione ATTACHMENT...
              String attachedFileName = new String(wdContext.currentContextElement().getFileName());
              boolean hasAttachment = (attachedFileName != null) && (attachedFileName.length() > 0);
              boolean isMultiPart = (mess != null) && (mess.length() > 1);
              //adding an attachment makes the message multipart
                 if (isMultiPart || hasAttachment) {
                    mp = new MimeMultipart();
                    // add text parts
                      if (mess != null) {
                         for (int i = 0; i < mess.length(); i++) {
                           bodyPart = new MimeBodyPart();
                           bodyPart.setContent(mess,"text/plain");
                           mp.addBodyPart(bodyPart);
                    //attach the file to the message if needed
                    if (hasAttachment) {     // avoid the case with no text parts
                         bodyPart = new MimeBodyPart();
                           bodyPart.setContent("Allegato incluso nel messaggio.","text/plain");
                           mp.addBodyPart(bodyPart);
                           // the part with the file
                           FileDataSource fds = new FileDataSource(attach);
                           MimeBodyPart attachmentBodyPart = new MimeBodyPart();
                        attachmentBodyPart.setDataHandler(new DataHandler(fds));
                        //URL URLattachedFileName = new URL(attach);
                        //attachmentBodyPart.setDataHandler(new DataHandler(URLattachedFileName));
                           attachmentBodyPart.setFileName(FileName);
                           mp.addBodyPart(attachmentBodyPart);
                    msg.setContent(mp);
                 } else {
                    if ((mess != null) && (mess.length() > 0)) {
                         msg.setContent(mess, "text/plain");
                    } else {
                         msg.setContent("", "text/plain");
              //fine ATTACHMENT 
              msg.setSentDate(new GregorianCalendar().getTime());
              msg.saveChanges();
              address = msg.getAllRecipients();
              Transport.send(msg, address);
           } catch (Exception e) {
                 e.printStackTrace();
                 return false;
           return true;
        //@@end
    When i used the same code in my application i am gett ing error in many places..
    1)FileDataSource fds = new FileDataSource(<b>attach</b>);
    attach cannot be resolved
    2)attachmentBodyPart.setFileName(<b>FileName</b>);
    fliename cannot be resolved
    3)byte[] file = element.getFileUpload();
    type mismatch cannot convert sting to byte[]
    4)element.setFileSize(this.getFileSize(file));
    method getFileSize() is undefined
    5)element.setFileExtension(binaryType.getMimeType().getFileExtension());
    method getFilExtension() is undefined
    6)URL = this.CreateAndGetPathFileUpload(wdContext.currentContextElement().getFileUpload(),FileName);
    method CreateAndGetPathFileUpload() is undefined.
    7)wdContext.currentContextElement().setPATHFileUploaded(URL);
    from the above error i can understand that only i have got the part of the code.
    Please send me the complete coding.
    some method definitions are missing....
    Please help me to send the mail with attachment from the file uploaded from the file upload ui element.
    Thanks in advance,
    shami.

    hi,
    I got this from the following link
    Re: Attaching an excel file
    plz help me ...
    I am using 2004s with nwds 7.0.06.
    also tell me what should be the type of the context variable FileUpload
    Thanks in advance,
    shami.

  • Send mail with attachment from webdynpro application

    hi,
    From a webdynpro application, the user will upload any files through the File upload ui element.These uploaded files has to go as an attachment in the mail which is being send to a particular ID ,when the user clicks the submit button in the form.
    can you please give me the code regarding this and help me in sending mail with attachment from a webdynpro application.
    Thanks in advance,
    shami.

    Hai,
    Properties props = System.getProperties();
           props.put("mail.smtp.host", "xx.xx.x.xx");
           Session session = Session.getDefaultInstance(props, null);
           Message msg = new MimeMessage(session);
           msg.setFrom(new InternetAddress("[email protected]"));
           msg.setRecipients(Message.RecipientType.TO,
           InternetAddress.parse("[email protected]", false));
           msg.setSubject(subject);
           msg.setText(body);
           msg.setHeader("X-Mailer", " Email");
           msg.setSentDate(new Date());
           MimeBodyPart messageBodyPart = new MimeBodyPart();
           messageBodyPart.setText("Hai , This mail Generated By the  Program");
          Multipart multipart = new MimeMultipart();
           multipart.addBodyPart(messageBodyPart);
            messageBodyPart = new MimeBodyPart();
            DataSource source = new FileDataSource("C:\nag.xls");//Here you need to give the Path of uploaded File
            messageBodyPart.setDataHandler( new DataHandler(source));
            messageBodyPart.setFileName("nag.xls");
            multipart.addBodyPart(messageBodyPart);
            // Put parts in message
            msg.setContent(multipart);
           Transport.send(msg);
    Regards,
    Naga

  • Mail not downloading from pop server

    I hit the get mail button, and I see "Incoming Messages" working away in the bottom left corner, but the messages don't get downloaded to my imac.
    I checked the Account INfo and the mail is on the POP server, but hasn't downloaded to my mail app.
    What can I do?

    This is bad. My Inbox now shows empty. I have checked the mbox/messages folder, and it contains a lot of emix files, which are readable, but strangely, they are very old, many from previous years. There are no recent mails in these emix files. Yet I only keep the last couple of months' emails in my Inbox!
    There are over 600 messages on the POP server, and I have stopped checking mail, in case Mail tells the server I have them, and my pending mails are deleted on the server. Checking Mail does not seem to show any new mails in my Inbox, although SpamSieve has logged several. (I have saved SpamSieve's log, so I can have its summary of emails I've supposedly received, and I can email their senders about them later if I have indeed lost these emails.)
    I have turned off TimeMachine, so it doesn't overwrite my previous Inbox. When I check it, it contains emails up to the point where I upgraded to Leopard (21 November), but when I open these emix files, they only have a title, no contents.
    I am confused and worried. Before upgrading to Leopard, I had a working mail client, and a lot of email in my Inbox. After upgrading, I can't receive mail, and my Inbox shows as empty. I have repaired permissions and restarted, more than once. Console has no comment: indeed, it shows no information after the 21st November (the day I upgraded), although other logs, such as the SpamSieve log, continue to update, and crash logs continue to be written. There are older "console" logs from previous dates, but the current "console" only goes up to 21st November.
    Please advise me. I am frightened to do anything else myself, in case I lose my data. My concentration is very limited, but I can follow simple instructions.
    I do not understand why Leopard Mail has rearranged my mailboxes. I had quite a few extra mailboxes within my overall account, and I filtered mailing list messages into them. (These mailboxes still contain their mail, including some messages which SpamSieve logs as received today.) These extra mailboxes are listed as part of "On My Mac", which I thought used to be the whole hierarchy, but after upgrading to Leopard, is only a sub-section of the hierarchy, listed after Reminders and Smart Mailboxes (I installed MailTags once, but had problems with it, so I removed it). Could this rearrangement of mailboxes be part of the current problem?
    Thankyou for any help you can offer.

  • How can I send e-mail with attachment from oracle 10g?

    How can I send email with attachment from oracle 10g?

    hi you can achieve the same thing from database tier of unix.

  • Sending mail with attachment from OIM

    Hi Experts,
    We have a requirement to send mail from OIM with attachment. Could not find any relevant document how to achieve this using Notification template and NotificationService.
    Any help would be appreciated.
    Thanks in advance.

    this feature is not supported by the product. check Doc ID 1444359.1
    You can raise a SR to know about it.

  • Sending e-mail with attachment from Oracle APEX

    Hi,
    Do we have an option to attach a report to the e-mail and send from Oracle APEX page?
    In my case, I want to convert the report page into PDF format and attach to the mail. Is it feasible in APEX?
    I understand that APEX_MAIL.ADD_ATTACHMENT can attach files stored in the database. But here we need to convert the page and send it
    Thanks
    Kind Regards,
    Prasanth

    HI,
    Thank you for your input. Currently I'm using APEX 3.2.
    Here my requirement is to send the content of the report to the user via e-Mail. If i'm not converting the page into PDF and planning to send as a HTML page or any other format.. The Objective is to send the info with the same format as it is in the report page. Its too big to send as mesage body.
    Any idea how to proceed?
    Regards,
    Prasanth

  • Sending Mail with attachment from WD

    Hi all,
    I wan't to send an email from webdynpro with an attached pdf-document. I had a look at Tutorial 31, but i will only use the first part, sending email with attached interactive form. So I decided to build a new project. I did everything as in the tutorial described, but when entering the following code into the wdDoInit method from the SendView an error occurs.
    //@@begin wdDoInit()
         //     @TODO Enter your email address for the setFrom and setTo methods by replacing the text in angle brackets.
         wdContext.currentEmailElement().setFrom("[email protected]");
         wdContext.currentEmailElement().setTo("[email protected]");
         wdContext.currentEmailElement().setCc("");
         wdContext.currentEmailElement().setBcc("");
         wdContext.currentEmailElement().setSubject("Travel Request Form");
         wdContext.currentEmailElement().setBody("BlaBlaBla");   
        //@@end
    In the coding is no error. In the Context node of the SendView I created a new value node with the value attributes. When writing the code and using strg+space i can complete automatically, so no writing errors.
    When deploying and running the application I get always a NullPointerException, if make no difference if i delete one entry or which line of code i insert, the same error.
    java.lang.NullPointerException
         at com.ao.test.emailtest.SendView.wdDoInit(SendView.java:99)
         at com.ao.test.emailtest.wdp.InternalSendView.wdDoInit(InternalSendView.java:127)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
         at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:274)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
    I've compared my project with the one from tutorial but i found no differences.
    Have anybody have an idea what to do?
    Thanks
    Mathias

    Hi,
    NullpOinter excepttion could be bcose of "currentEmailElement()".
    Please create an element of EmailNode before these statements.
    IPrivate<ViewName>.IEmailElement ele=wdContext.createEmailElement();
    wdContext.NodeEmail().addElement(ele);
    You can use the following for sending attachments :
    BodyPart messageBodyPart = new MimeBodyPart();
    messageBodyPart.setText(Attachment);
    Multipart multipart = new MimeMultipart();
    multipart.addBodyPart(messageBodyPart);
    messageBodyPart = new MimeBodyPart();
    DataSource source = new FileDataSource(Attachment);
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName(Attachment);
    multipart.addBodyPart(messageBodyPart);
    msg.setContent(multipart);
    Regards, Anilkumar
    Message was edited by: Anilkumar Vippagunta

  • Help in sending mails with attachment from workflow

    Hi Experts,
    I have a document in my local PC. Can anyone tell me how to send it like an attachment from workflow.
    Thanks  in advance.

    Hi,
    when u want to send the attachment along with document created, then u can see the Service Object in left hand top corner. There u can attach your file. So that it will go with the document.
    Regards,
    JMB

  • Sending mail with attachment from Photos App get stuck in Outbox

    Hey,
    As it is described in the title, the photos I have previously selected in Photos App ( by clicking send > by mail ) get stucked in my Outbox.
    In opposition to some other discussions, I can edit/delete that stucked mail, and even send it if I manually click again on "Send" from the outbox !
    Other funny conclusion : If I copy&paste the photo and compose a new message from the Mail App, the same mail isn't stuck.
    I tried to delete/reconfigure my Exchange Account, it doesn't change anything.
    Google Mail account configured with Exchange Account.
    Synchronising Mail&Calendar
    Push activated
    (It definitely worked properly before)
    Device: Iphone 4
    Carrier: Orange France
    Country / Language: FR
    OS / Browser / build number (if applicable): iOS 4.1 8B117

    Hi,
    Please run Word in Safe Mode to test if it's 3rd-party add-ins related:
    Press Win + R and type “word.exe /safe” in the blank box, then press Enter.
    If there’s no problem in Safe Mode, disable the suspicious add-ins to verify which add-ins caused this issue.
    We can also refer to the link below, to learn more and check the possible settings that may affect this behavior:
    http://www.msoutlook.info/question/278
    Regards.
    Melon Chen
    TechNet Community Support
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to send Notification mail (with attachement) from On-Demand job

    Hi Experts,
    I am using SAP IDM 7.2 SP8.
    Requirement is to send a notification mail to a specific mail address [email protected] whenever we run a on-demand job.
    On-Demand job should also attach a csv file (atttachement.csv, which is in a specific folder D:\folder) while sending the notification mail.
    Please help.
    Thanks & Regards,
    Chandan Kumar

    Hi there,
    It sounds like you have the basics all together. I would check how you are setting the following parameters of uSendSMTPMessage:
    Attachment
    Optional. Fully qualified file name of a file to be included as an attachment.
    Multiple attachments can be added by separating the file names by a pipe character (|).
    AttachmentType
    Optional. Valid MIME attachment type.
    Charset
    Optional. Valid ISO character set identifier, for instance ISO-2022-JP. The default value is ISO-8859-1.
    HeaderEncoding
    Optional. 0: Plain text, 1: Base64. Default: 0
    TransferEncoding
    Optional. 1: 7bit, 2: 8bit, 3: Quoted ASCII, 4: Base64. Default: 4.
    Sorry the first row got mangled a bit. 
    Matt

  • Email with attachment from flash

    Please I need to know how can I send an e-mail with
    attachment from a swf aplication
    Thanks...

    I didn't find it. Generally people who write Java APIs like that will document restrictions (like "Requires Java 5 or later") if they exist. You won't generally find "Works will all versions of Java" in the documentation because that's just a basic assumption of Java.

  • Question: Is there a way to create a PDF from outlook e-mail that does not embed the attachment? better, is there a way to convert the e-mail with attachement (not embeded) as pdf pages? - Problem: I have 1400 e-mails with attachments that need to be conv

    Is there a way to create a PDF from outlook e-mail that does not embed the attachment? better, is there a way to convert the e-mail with attachement (not embeded) as pdf pages?
    - Problem: I have 1400 e-mails with attachments that need to be converted into pdf and the attachments cannot be embeded.
    System: PC Windows 7 using Acrobat X Prof. - Thank you!

    Hi ,
    There is an option of embedding index for faster search while converting email to a PDF .
    However I am not sure that will serve your purpose or not .
    I would recommend you to get in touch with Microsoft support as well .
    Meanwhile I'll work on it and get back to you in case I get a desired solution .
    Regards
    Sukrit Dhingra

  • Sending an E-mail with attachment with PHP from Flex

    Hey,
    I've made a custom compontent wich mails your own drawings to you. But I have a problem to send an e-mail with attachment.
    I use the HttpService to send the data to the php-file, but I always get the Fault message (form phpFault()).
    This is my code in Flex:
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.graphics.codec.PNGEncoder;
            import mx.events.ValidationResultEvent;
            import mx.controls.Alert;
            [Bindable]
            private var byteArray:ByteArray;
            private function mailImage(comp:DisplayObject):void
                var emailValidation:ValidationResultEvent = validEmail.validate();
                if(emailValidation.type == ValidationResultEvent.INVALID)
                    Alert.show("Invalid E-mail");
                else
                    var bitmapData:BitmapData = new BitmapData(comp.width, comp.height);
                    bitmapData.draw(comp);
                    var png:PNGEncoder = new PNGEncoder();
                    byteArray = png.encode(bitmapData);
                    httpMail.send();
            private function phpResult(evt:ResultEvent):void
                Alert.show("You've got mail.");
            private function phpFault(evt:FaultEvent):void
                Alert.show("Something went wrong. /n" + evt.message.toString());
        ]]>
    </mx:Script>
    <mx:EmailValidator id="validEmail" source="{ipEmail}" property="text"/>
    <mx:HTTPService id="httpMail" url="php/byte-receiver.php" method="POST" result="phpResult(event)" fault="phpFault(event)">
        <mx:request>
            <img>{byteArray}</img>
            <mail>{ipEmail.text}</mail>
        </mx:request>
    </mx:HTTPService>
    <mx:Label text="draw your own image" styleName="h1" x="10" y="0" width="493" height="60"/>
    <mx:Canvas
        id="drawCanvas"
        x="10" y="77"
        width="561" height="245"
        borderStyle="solid" borderColor="#A6A6A6">
    </mx:Canvas>
    <mx:Label x="10" y="329" text="Your e-mail:" styleName="text"/>
    <mx:TextInput
        id="ipEmail"
        x="86" y="324" width="417"/>   
    <mx:Label
        id="lblMailImage"
        x="10" y="383"
        text="Mail my image"
        click="mailImage(drawCanvas)"
        mouseOver="lblMailImage.setStyle('color',  '#00067b')"
        mouseOut="lblMailImage.setStyle('color',  '#717171')"
        styleName="button"/>
    </mx:Canvas>
    This is my PHP code
    <?php                 
    $fileatt_type = "application/octet-stream"; // File Type
    $fileatt_name = "ImgContact.png"; // Filename that will be used for the file as the attachment
    $email_from = "[email protected]"; //Who the email is from
    $email_subject = "Contact Winckelmans.net"; // The Subject of the email
    $email_message = "Mail send by winckelmans.net. Your drawing is in the attachment"; // Message that the email has in it
    $email_to = $_POST['mail']; // Who the email is too
    $headers = "From: $email_from";  
    $data= $_POST['img'];
    $semi_rand = md5(time());  
    $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";  
    $headers .= "\nMIME-Version: 1.0\n" .  
                "Content-Type: multipart/mixed;\n" .  
                " boundary=\"{$mime_boundary}\"";  
    $email_message = "This is a multi-part message in MIME format.\n\n" .  
                    "--{$mime_boundary}\n" .  
                    "Content-Type:text/html; charset=\"iso-8859-1\"\n" .  
                   "Content-Transfer-Encoding: 7bit\n\n" .  
    $email_message . "\n\n";  
    $email_message .= "--{$mime_boundary}\n" .  
                      "Content-Type: {$fileatt_type};\n" .  
                      " name=\"{$fileatt_name}\"\n" .  
                      //"Content-Disposition: attachment;\n" .
                      //" filename=\"{$fileatt_name}\"\n" .
                      "Content-Transfer-Encoding: base64\n\n" .  
                     $data . "\n\n" .  
                      "--{$mime_boundary}--\n";  
    $mailsend = mail($email_to, $email_subject, $email_message, $headers);  
    echo $mailsend;
    ?>
    This is the error I get in an Alert:
    (mx.messaging.messages::ErrorMessage)#0
      body = ""
      clientId = "DirectHTTPChannel0"
      correlationId = "F3C16CE1-65CF-E690-1907-D28293FD6BB9"
      destination = ""
      extendedData = (null)
      faultCode = "Server.Error.Request"
      faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: php/byte-receiver.php"]. URL: php/byte-receiver.php"
      faultString = "HTTP request error"
      headers = (Object)#1
        DSStatusCode = 0
      messageId = "7A1DCDBE-0358-7E39-3AF8-D282945A7748"
      rootCause = (flash.events::IOErrorEvent)#2
        bubbles = false
        cancelable = false
        currentTarget = (flash.net::URLLoader)#3
          bytesLoaded = 0
          bytesTotal = 0
          data = ""
          dataFormat = "text"
        eventPhase = 2
        target = (flash.net::URLLoader)#3
        text = "Error #2032: Stream Error. URL: php/byte-receiver.php"
        type = "ioError"
      timestamp = 0
      timeToLive = 0
    Thanks in advance
    Vincent

    Hi
    I'm having the same issue, except my application actually sends the email but the attachment is 0 octet and it doesn't even give me an error... Any chance you found a solution for this and could share it ?
    Thanks

  • Can I mail with  attachment by using NSURL maito?

    Can I mail with attachment by using NSURL maito?

    RainApple wrote:
    It seems there are open source project to implement it.
    Custom API...
    Google for skpsmtpmessage

Maybe you are looking for