Emal with attachment from package

Hi
i tried to send email with attachment file from package, these files may be pdf, xls or any type of file , i tried ces package but is not working and i try UTL_SMTP package but this package send just txt file.
i need to know if there is any tools or existing package do that,
regard

I think you should change Mime Type of attachment
For example, to send binary zipped tar file as attachment, [I used *application/octet-stream* mime type|http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/] . To send pdf as attachment, [you should use *application/pdf* mime type|http://www.google.az/search?hl=az&q=content-type+for+pdf] .
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com
[Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

Similar Messages

  • 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

  • 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.

  • 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.

  • 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 PO with attachment from SRM to ERP

    Hi Experts,
    My requirement is to Send PO with attachment from SRM to ERP.
    I can get the attachment in the payload as mentioned in https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3509. [original link is broken] [original link is broken] [original link is broken]
    But how to post this attachment into the target ERP system so that it gets saved as an attachment in the Purchase Order.
    Thanks & Regards,
    Shobhit

    Hi Shobhit,
    I asume, the PO is send as an IDOC to ERP?
    In this case, you have no chance to attach the attachment.
    A wortkaoud would be to extract the needed date from the attachment and map the values into correcponding fields of the PO-Idoc.
    Regards Mario

  • 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 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

  • Send email with attachment from Q2 notification to external email

    Hi,
    Whenever I create a Q2 notification, I want to send the vendor, details of the notification as attachment. Now it is copying the "coordinator" from partner function. But not copying vendor data in select partner function. Here I have to manually select the vendor. Another question here is that, this email should trigger to the email id of vendor maintained in the vendor master. This email address will be an external id. Please suggest the best way to send email to vendor along with attachment.
    Thanks
    Vineeth

    Hi
    Check with this sap note 208271 "Sending Notification email with Print function"
    and required basis configuration.
    Regards
    Shiva

  • Email with attachment from servlet

    Hi. We're using Java 1.4.2_12 and need to send emails with an image file attachment from a servlet. The JavaMail API looks interesting but wasn't sure if it works with our (ancient) version of Java. Your help is much appreciated. Thanks.
    Edited by: curios_Lee on Jan 16, 2009 8:38 AM

    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.

  • 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.

  • 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 email with attachment from iCloud

    when i am sending email with attachment, when i am sending email with attachment I found that the mail was send and still on draft on the client software on my mac book pro. Any solution please??

    That happens at times.  Don't know why.  Just delete the email in the drafts folder, as long as you are sure it was sent (check the sent folder).  I've wondered whether it's a timing issue.

  • SOAP call with attachment from ABAP

    Dear ABAP guru's
    We have a requirement to trigger a SOAP call from the ABAP stack. We have used the instructions from SAP as specified in the SAP help as specified in this link:
    http://help.sap.com/saphelp_47x200/helpdata/en/2d/64d029e74911d6b2e400508b6b8a93/frameset.htm
    This works fine. However, we would like to send an attachment with the call and don't see a method available for this. Is there anybody who knows how to achieve this?
    Thanks a lot in advance,
    Rudy Claassen

    Dear ABAP guru's
    We have a requirement to trigger a SOAP call from the ABAP stack. We have used the instructions from SAP as specified in the SAP help as specified in this link:
    http://help.sap.com/saphelp_47x200/helpdata/en/2d/64d029e74911d6b2e400508b6b8a93/frameset.htm
    This works fine. However, we would like to send an attachment with the call and don't see a method available for this. Is there anybody who knows how to achieve this?
    Thanks a lot in advance,
    Rudy Claassen

  • Move Message with Attachment from one Mailbox to another problem

    Hi,
    starting with Exchange 2013 we have following odd thing. 
    (That happens with Outlook 2010 aswell as Outlook 2013). 
    My mailbox has several other mailboxes mounted aswell. (using Full Access at ECP Settings), aswell as one separate Exchange Mailbox with own User/Password. 
    Now, when I have an Email with an attachment (like Word, .jpg, whatever), I used to move it to another mailbox by using "drag & drop". 
    The mail was moved to the mailbox without noticable changes. 
    Starting with Exchange 2013, the Mail is changed into Rich Text. That means, the attachment now appears somewhere within the message, instead as real attachment. Some attachments are also lost, and as the message was moved, the only way to recover it is
    using our external Email Archive. 
    Is this a bug, or didn't I see any option that results in this odd behaviour?
    Moving to a different folder does work as expected, but not to another mailbox.
    Thanks
    Patrick 

    Based on some research we have decided to create a workaround as all mails got converted from HTML to Rich Text when moving from User Mailbox to a PST(Archive).
    We have built an add-in for end-users to archive based on the following Outlook-VBA
    Option Explicit
    Sub MoveToFolder()
    Dim objApp As Outlook.Application
    Dim strPath As String
    Dim objNS As NameSpace
    Dim objFolder As Outlook.MAPIFolder
    Dim olCurrExplorer As Outlook.Explorer
    Dim olCurrSelection As Outlook.Selection
    Dim olCurrMailItem As MailItem
    Dim m As Integer
    'pick destination folder
    Set objApp = CreateObject("Outlook.Application")
    Set objNS = objApp.GetNamespace("MAPI")
    Set objFolder = objNS.PickFolder
    'get selected mails
    Set objNS = objApp.GetNamespace("MAPI")
    Set olCurrExplorer = objApp.ActiveExplorer
    Set olCurrSelection = olCurrExplorer.Selection
    For m = 1 To olCurrSelection.Count
    Set olCurrMailItem = olCurrSelection.item(m)
    On Error Resume Next
    olCurrMailItem.Move objFolder
    If Err.Number <> 0 Then
    With olCurrMailItem
    ' due this week flag
    .MarkAsTask olMarkThisWeek
    ' sets a specific due date
    .TaskDueDate = Now + 3
    .FlagRequest = "Call "
    .Save
    .FlagStatus = olFlagComplete
    End With
    olCurrMailItem.Move objFolder
    End If
    Next m
    End Sub
    for us it was important to have the mails still in HTML Formats as some customers are sending embedded images in the mail-body which are removed when the mail where converted to Rich Text.
    For people who doesn't care in which format an mail gets archived another workaround is to Flag the Message with an follow up action, then unflag (complete the follow up) and users are able to move the messages but still they would be converted from HTML
    to Rich Text.
    Strange enough that with a simple VBA move event the message will stay in HTML Format we are happy to found a solution and maybe someone else can use it.

Maybe you are looking for

  • Invoice transport costs with multiple account assignment

    Hello Gurus, My problem is the following: 1) I create two sales orders with the same forwarding agent "A" 2) I create the two deliveries with the forwarding agent "A" 3) I create a transport for those two deliveries and the same forwarding agent A 4)

  • Tomcat Servlet Security Problem? : Start Excel with NJAWIN - COMObjects

    I get an exception when I start my programm as servlet , as application it works just fine (when I start it as Servlet in the internal Tomcat from JBuilder it also works fine). Application app = new Application(Application.progID); // interfaces buil

  • Loss of picture quality?

    I am making a commercial for class and am having a problem exporting .avi files to the .mp4 files. There seems to be some loss in picture quality. The pictures are darker than in the .avi files. My professor says that theoretically there should be no

  • Do i need to return this battery

    I recently purchased a new battery for my Power Book from newer technologies. When I first put it in and charged her up the full charge capacity was 5000. After the second discharge, the full charge capacity is now at 4600 as indicated below. It's ch

  • How to remove multiple iphoto images from imovie timeline?

    When I import still photos into imovie  from iphoto, and drop them on the timeline in imovie,  instead of a single picture appearing I get multiple copies of the same photo.  Can anyone suggest a cure or workaround?