Creation of email with attachment number

I have tried to make it work for a while but gave up on it and just took it. I want to be able to click on a menu item in my application that creates an empty e-mail message with an attachment jpeg or png. This is the code I have now:

try{
                Class cl = Class.forName("com.myname.etc");
                InputStream input = cl.getResourceAsStream("/test.jpg");
                int available = input.available();

                byte[] data = new byte[available];
                input.read();

                Multipart multipart = new Multipart();

                SupportedAttachmentPart attach = new SupportedAttachmentPart(multipart, "image/jpeg", "test.jpg", data);
                multipart.addBodyPart(attach);

                Message m = new Message();
                m.setSubject("This is a test");
                m.setContent(multipart);
                Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
                input.close();
            } catch (MessagingException e) {
                System.out.println("MessagingException");
            } catch (ClassNotFoundException e) {
                System.out.println("ClassNotFoundException");
            } catch (IOException e) {
                System.out.println("IOException");
            }

In the Simulator, the application gives me the following error: e-mail service does not support these types of attachments. Change the field send aid or remove attachments.

During the test on a device, it creates the email with the attachment very well, but when I opened the attachment I get a warning that says: Document is empty

I try to use an image that is saved in the folder of my application's resources. I tried the tutorial but have problems. I use 4.6 JRE.

Thanks in advance

Advertisement

I thought about it, this code works:

inputStream = getClass().getResourceAsStream("\test.jpg");

byte[] data = IOUtilities.streamToBytes(inputStream);

inputStream.close();

Multipart multipart = new Multipart();

SupportedAttachmentPart attach = new SupportedAttachmentPart(multipart, "image/jpeg", "test.jpg", data);

multipart.addBodyPart(attach);

TextBodyPart emailBody = new TextBodyPart(multipart, "This is the body message");

multipart.addBodyPart(emailBody);

Message m = new Message();

m.setSubject("This is the subject");

m.setContent(multipart);

Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));

Tags: BlackBerry Developers

Similar Questions

  • Can we have more than one attachment to the activity "email with attachment.

    Guys,

    I have a condition in which the process has n number of approvers in the stream, and each approver can add attachments to the form in the variable list < document > which transports rasthaus documents.

    At the end of the process, I'm supposed to send an email with all the files attached to a help desk team.

    I know that the activity to send an e-mail with an attachment supports one attachment. y at - it a possibility or any other activity that I can use to send an email with any number of attachments?

    Hey Ashok

    The service you want is called "send with map of attachments. This service is not on the toolbar.

    If you drag on the market to define the activity type "email" in the search box, you can see the title of the foundation that there is 3 e-mail services.

    Choose send with map of attachments.

    For help on this service, see: http://help.adobe.com/en_US/livecycle/9.0/workbenchHelp/help.htm?content=000570.html

    Diana

  • I tried to send an email with attachment and without attachment and received the "windows live Hotmail was not able to complete this application. "Microsoft may contact you about problems that report you.

    I tried to send an email with attachment and without attachment and received the error "windows live Hotmail was not able to complete this application. "Microsoft may contact you about problems that report you.

    Hi AbdiNur,

    This forum is for comments on the Microsoft Answers site.  As your question is on Hotmail, I recommend posting your question on the forums for Hotmail:

    http://www.windowslivehelp.com/forums.aspx?ProductID=1

    Thank you for using Microsoft Answers!

  • Emails with attachment downloading with a symbol of firefox. How can I change to display a PDF instead? I use windows mail on a Vista system.

    Emails with attachment downloading with a symbol of firefox. How can I change to display a PDF instead? I use windows mail on a Vista system.

    Shrinivas Kulkarni

    Right click on the downloaded file, choose "Open with" and choose the program proper.  She'll use the icon of the program you select.

  • Email with attached video will not leave the Outbox... Cannot delete Email with the attached video.

    Email with attached video will not leave the Outbox... Cannot delete Email with the attached video.

    Check to work offline , and then it should delete.

  • I have an email with attached wps files but I can't open them im using windows 7, someone please help

    I have an email with attached wps files but I can't open them im using windows 7, someone please help

    It is a Microsoft Works file you need a viewer for. Have a look here.

    http://www.Microsoft.com/en-CA/Download/details.aspx?ID=4

    I hope this helps.

  • Error in creating the body of HTML for Email with attachment

    I have an application where I send emails with an attachment. It seems to work very well. I'm now add content to the body of the Email and I'm running on about how set up the body. To test, I created a small amount of html code which is placed in part p_body_html of the script send mail, but because it's going to be a little (more than 1000 characters) to create the real html table, I'm trying to create in a declared variable and then have the p_body_html call the variable l_body_html and that's where I'm running into the following error message :

    1 error has occurred
    * ORA-06550: line 9, column 9: PLS-00307: too many statements of 'SEND' fits this call
    ORA-06550: line 9, column 1: PL/SQL: statement ignored

    Code that works is:
     
    DECLARE
        l_id NUMBER;
        l_body_html CLOB;
    BEGIN
    l_id := APEX_MAIL.SEND(
            p_to        => :P4_TO,
            p_from      => '[email protected]',
            p_body      => 'Please review the attachment.',
            p_body_html => '<html><head></head><body><table width="615" border="0" align="center" cellpadding="0" cellspacing="0" RULES=NONE FRAME=BOX style="cellpadding:0 cellspacing:0"><tr><td height="32" colspan="2" bgcolor="#FF0000">Information</td></tr><tr><td colspan="2">Testing</td></tr><tr><td>One</td><td>Two</td></tr></table></body></html>',
            p_subj      => :P4_TITLE);
    FOR c1 IN (SELECT filename, attachment, mimetype 
            FROM ATTACH_EMAIL
            WHERE recordid = :P4_recordid) LOOP
    
            APEX_MAIL.ADD_ATTACHMENT(
                p_mail_id    => l_id,
                p_attachment => c1.attachment,
                p_filename   => c1.filename,
                p_mime_type  => c1.mimetype);
            END LOOP;
        COMMIT;
    END;
    The code that does not work is:
    DECLARE
        l_id NUMBER;
        l_body_html CLOB;
    
    BEGIN
    l_body_html :='<html><head></head><body><table width="615" border="0" align="center" cellpadding="0" cellspacing="0" RULES=NONE FRAME=BOX style="cellpadding:0 cellspacing:0"><tr><td height="32" colspan="2" bgcolor="#FF0000">Information</td></tr><tr><td colspan="2">Testing</td></tr><tr><td>One</td><td>Two</td></tr></table></body></html>';
    
    l_id := APEX_MAIL.SEND(
            p_to        => :P4_TO,
            p_from      => '[email protected]',
            p_body      => 'Please review the attachment.',
            p_body_html => l_body_html,
            p_subj      => :P4_TITLE);
    FOR c1 IN (SELECT filename, attachment, mimetype 
            FROM ATTACH_EMAIL
            WHERE recordid = :P4_recordid) LOOP
    
            APEX_MAIL.ADD_ATTACHMENT(
                p_mail_id    => l_id,
                p_attachment => c1.attachment,
                p_filename   => c1.filename,
                p_mime_type  => c1.mimetype);
            END LOOP;
        COMMIT;
    END;
    I said the l_body_html as CLOB then I fill it with code and then I reference it the p_body_html. I have this work under other forms of e-mail with no attachments and it works fine. Don't know how I have too many statements as the error States and would appreciate any help

    Thank you
    Wally

    Hi Wally,

    The SEND() function may take varchar2s or CLOB to p_body and p_html_body. In your code, you declare l_body_html as a CLOB, but assigning a string. It is possible that the database is confused?

    Try to use TO_CLOB ('...') to set the value of l_body_html

    Andy

  • Sending email with attachment.

    Hello guys,.

    I need to send an email with the picture attached.

    I composed an email with fields pre-filled,

    void SocialInvocation::sendEmail (const QString & uri) {}

    Application of InvokeRequest;
    request.setTarget ("sys.pim.uib.email.hybridcomposer");
    request.setAction ("bb.action.COMPOSE");
    request.setMimeType("message/rfc822");
    QVariantMap data;
    data ['a'] = "[email protected]";
    data ['object'] = 'Test ';
    data ['body'] = "Body";
    data ["attachment"] = QDir::currentPath() + "/ app/native/assets/image.jpg";
    MoreData QVariantMap;
    moreData ['data'] = data;

    bool ok;

    request.setData (bb:psObject::encode(moreData, &ok));))

    m_invokeManager-> invoke (request);

    }

    It works fine, but there is an error in the attached picture (size 0) and when I send the mail it successfully delivered but without images.

    This will not work because the files under the app / (and also data /) will be not readable by anything outside of your application, and this includes the PIM.

    I think that copy the file to ./sharewith/pim before use is the approach provided, although to be honest, I have not seen also documented yet.

  • new computer trying to re-download student edition program not found email with serial number

    This is the old number computer broken so obtained, it replaced. Now Im having problems locating the email with the serial number to download again student cs5 edition. Is there a way to get a new one issued? How would this work?

    Thank you

    You must have an account with Adobe and in this account, there should be a record of your programs and the serial numbers used to activate them.

    The edition of students should not be different from any other, so you have to just download the demo version of the software and then activate it using your serial number.

    You can download the demo version of the software using the link below and then use your current serial number to activate it.

    Don't forget to follow the steps described in the Note: very important article Instructions on the pages to download to this site or the download may not work properly.

    CS5: http://prodesigntools.com/all-adobe-cs5-direct-download-links.html

    If you have problems with the number of series or activation, you must contact Adobe technical support by chat or phone.

    Here are some links to help get in touch:

    http://www.Adobe.com/support/chat/ivrchat.html

    http://www.Adobe.com/support/download-install/supportinfo/

  • Send Email with attachment of more than 32K

    Hello
    I wanted to produce an output of a query and send the output as an attachment using [demo_mail | http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt] package given on the Oracle website.

    The only part that I changed in this package is the values of the following 2 variables:

    smtp_host VARCHAR2 (256): = 'localhost ';
    smtp_domain VARCHAR2 (256): = "my_ompany_name.com";

    Then I said a PLSQL block anonymous to send the query output as an attachment in the email. Here is the PLSQL block.

    The mail is sent, but the query output (cursor) goes in the body of the message itself.

    Body of the email contains

    -7D81B75CCC90D2974F7A1CBD
    Content-Type: text/plain
    Content-Disposition: attachment; filename = "Arun.csv"
    Content-Transfer-Encoding: 7 bit

    < query result >

    -7D81B75CCC90D2974F7A1CBD-


    Oracle Version_

    SQL > select * from v version $;

    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    DECLARE
       lv_sender      VARCHAR2(200)  := '[email protected]';
       lv_recipients  VARCHAR2(200)  := '[email protected]';
       lv_subject     VARCHAR2(200)  := 'Attachement Test';
       lv_mime_type   VARCHAR2(200)  := 'text/plain';
       lv_priority    PLS_INTEGER    := NULL;
       lv_last        BOOLEAN        := FALSE;
       lv_count       NUMBER         := 0;
       lv_message     VARCHAR2(32000);
       lv_conn        utl_smtp.connection;
    
       CURSOR cur_query
       IS
       SELECT       col_1
             ||'|'||col_2
             ||'|'||col_3
             ||'|'||col_4
             ||'|'||col_5
             a
         FROM table_name;
         
    BEGIN
       lv_conn:=  demo_mail.begin_mail
                            (  lv_sender
                              ,lv_recipients
                              ,lv_subject
                              ,lv_mime_type
                              ,lv_priority
                            );
    
       demo_mail.begin_attachment
                 ( lv_conn
                  ,lv_mime_type
                  ,FALSE          -- Means its not inline
                  ,'Arun.csv'
                  ,'7 bit'
                 );
    
       FOR rec IN cur_query
       LOOP
          lv_message := lv_message||rec.a||chr(13);
          lv_count := lv_count + 1;
    
          IF ( MOD(lv_count,50) = 0 ) THEN
             demo_mail.write_text( lv_conn
                                  ,lv_message
                                 );
             lv_message := NULL;
          END IF;
       END LOOP;
    
       demo_mail.write_text ( lv_conn
                             ,lv_message
                            );
    
       demo_mail.end_attachment
                (  lv_conn
                  ,TRUE
                );
    
       demo_mail.end_mail(lv_conn) ;
    END;
    /
    No problem with the code above, sending the output as inline th emessage body instead of an attachment?

    Concerning
    Arun

    Published by: Arun Kr Gupta on February 3, 2010 13:31
    Modified cursor name in executable section

    Published by: Arun Gupta of Kr on February 4, 2010 16:25

    Okay, I copypasted the demo_mail package and isn't available to me now on my own playground XE DB.
    Playing with (or: 'test') your example revealed that simply by making a few minor adjustments.
    Keywords are:
    -read the comments in the package header
    -mime-type
    -You'll love this link: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/mailexample_sql.txt

    Here's a simple test case that worked for me (after do downloadable several upsetting him ;)), you will see that you were already very close:

    DECLARE
       lv_sender      VARCHAR2(200)  := '[email protected]';
       lv_recipients  VARCHAR2(200)  := '[email protected]';
       lv_subject     VARCHAR2(200)  := 'Attachment Test';
    --   lv_mime_type   VARCHAR2(200)  := 'text/plain';
       lv_priority    PLS_INTEGER    := NULL;
       lv_last        BOOLEAN        := FALSE;
       lv_count       NUMBER         := 0;
       lv_message     VARCHAR2(32000);
       lv_conn        utl_smtp.connection;
    
       CURSOR cur_query
       IS
       SELECT dummy a
       from   dual
       connect by level <= 1000;
    
    BEGIN
       lv_conn:=  demo_mail.begin_mail
                            (   lv_sender
                              , lv_recipients
                              , lv_subject
                              , demo_mail.multipart_mime_type
                              , lv_priority
                            );
    
       demo_mail.begin_attachment
                 ( lv_conn
                  ,'text/html'
                  ,FALSE          -- Means its not inline
                  ,'test.csv'
                  ,'7 bit'
                 );
    
       FOR rec IN cur_query
       LOOP
          lv_message := lv_message||rec.a||chr(13);
          demo_mail.write_text( lv_conn,lv_message);
    --      lv_count := lv_count + 1;
    --      IF ( MOD(lv_count,50) = 0 ) THEN
    --         demo_mail.write_text( lv_conn
    --                              ,lv_message
    --                             );
    --         lv_message := NULL;
    --      END IF;
       END LOOP;
    
       demo_mail.end_attachment
                (  lv_conn
                  ,TRUE
                );
    
       demo_mail.end_mail(lv_conn) ;
    END;
    /
    

    Keep in mind: I had to change your cursor for obvious reasons...
    Let us know how it works in your situation, because I was not tested with very large attachments (> 32 k).
    Well well, to be honest, this one (level <= 64000)="" is="" still="" running...but="" you="" know,="" i="" really="" could="" use="" a="" new=""> ;))

  • Call for email with attachment - broke up with 10.2?

    The following used to work properly on 10.1, but on 10.2, the call fails.

        attachedObjects: [
            Invocation
            {
                id: emailQuery
                query
                {
                    invokeActionId: "bb.action.SHARE"
                    mimeType: "*"
                    invokeTargetId: "sys.pim.uib.email.hybridcomposer"
                }
                onArmed:
                {
                    trigger("bb.action.SHARE");
                }
            }
        ]
    
        function shareFiles(s)
        {
            console.debug("file://" + s)
            emailQuery.query.uri = "file://" + s;
            emailQuery.query.updateQuery();
        }
    

    and returns to the console log.

    file:///accounts/1000/shared/documents/mydatafile.csv
    InvocationWrapper::onQueryFinished: no matching result from Menu Service for query
       mimeType="*"
       uri=QUrl("file:///accounts/1000/shared/documents/mydatafile.csv")
       data= ""
       metadata= QMap()
       perimeter= 0
       action= "bb.action.SHARE"
       target= "sys.pim.uib.email.hybridcomposer"
       invokerIncluded= false
    InvocationPrivate::onQueryResolved: no result matching query, no armed signal sent.
    

    Any suggestions... Tried a different approach when searching for different thread related to the topic but so far no luck...

    This is confirmed to not work in 10.2 (wire)

    I had questions about the year 10.0 with her last and switch to a version of c ++ which is still working on the last update

    * Assuming a context property is set in this example, it is RPC.

    applicationUI.cpp

    #include 
    #include #include 
    
    using namespace bb::system;
    
    void ApplicationUI::email()
    {
        InvokeRequest request;
        request.setAction("bb.action.COMPOSE");
        request.setMimeType("message/rfc822");
        QVariantMap data;
        data["to"] = (QVariantList() << "[email protected]");
        data["subject"] = "Message Title";
        QVariantMap moreData;
        moreData["data"] = data;
        bool ok;
        request.setData(bb::PpsObject::encode(moreData, &ok));
        InvokeManager manager;
        manager.invoke(request);
    }
    

    applicationUI.hpp

    namespace bb
    {
        namespace cascades
        {
            class Application;
            class LocaleHandler;
        }
        namespace system
        {
            class InvokeManager;
        }
    }
    
    public:
        ApplicationUI(bb::cascades::Application *app);
        virtual ~ApplicationUI() { }
    
        Q_INVOKABLE void email();
    

    . QML

    Button {
       onClicked: {
         cpp.email();
      }
    }
    

    * I belive files may be attached, if you add in the table of data of QVariantMap, I think that should do the trick

    data["attachment"] = "file:///path/to/my/item.txt";
    
  • Send email with attachment

    Hello. How to create a procedure that will send an e-mail with an attachment?
    I have a stored somewhere text file that will be used as an attachment. Thank you!

    This will help you.

    http://www.Oracle-base.com/articles/Misc/email-from-Oracle-plsql.php#attachment

  • sending email with attachment, recipient recives .jpg multiple copies that cannot be opened or saved

    Windows 7 using windows live mail after sending e-mail with an attachment .jpg, the recipient receives multiple copies that cannot be read, opened or saved.

    Right click on the name of the account above the Inbox. Properties | Advanced tab and uncheck the box: "Break apart messages...". ».

  • I tried to send an email with attachment and keep trying now and ends not to try the loop a little...

    I tried to send a mail, but something happens and I can't stop the action of 'send message '. The problem is my account does not work and he creates something like a loop... try and try, and I cannot use mail...

    Quit or Force Quit Mail, disconnect from the Internet, or turn off Wifi if it's how sign you, Start Mail, then you should get a chance to remove it, eventually the attachment is too big?

  • To retrieve the email with attachment deleted once delete folder

    Original title: Lost email w / attachments

    I deleted an important email message that had multiple attachments. Also, I emptied my file to delete. Can I get the e-mail? How? I got the message in the email I replied to the sender, but it does not show the attachments. Can you help me?

    Original title: Lost email w / attachments

    I deleted an important email message that had multiple attachments. Also, I emptied my file to delete. Can I get the e-mail? How? I got the message in the email I replied to the sender, but it does not show the attachments. Can you help me?

    If you use an email account for the POP protocol, and if your account settings include leave a copy of messages on the server, then go to your webmail site, sign in to your account and see if the mail in question is still there.

    Otherwise, he is gone.

Maybe you are looking for

  • Why don't you the symbol "locked" little more?

    When I connect to a company website that I want to buy a product, I no longer get the 'padlock' in the lower right of my screen. Locked meant site safe and unblocked meant not to use. Now I get no symbol. It doesn't matter if I also signed on their s

  • iTunes deletes music synchronized to new computer...

    I have to be honest, it is less of an issue and more just me desperately need help.  I tried to sync my iPod (4th generation) to my new laptop with a USB cable, and after that, I had downloaded music has been removed from my iPod.  105 to 72 songs, 6

  • Cannot find the memory of the satellite 1900 203

    My satellite 1900 203 has a memory problem and I want to replace it.The manual says there is no memory which is really internal and fixed to the motherboard. The memory would be on 2 slots extension, available for the upgrade to 1 GB.On the place ind

  • Satellite L855 - 10 X - very weak WiFi signal

    I checked some help forums, but couldn't t find something useful. I came to the conclusion that IT IS NOT DRIVER or BIOS related. Sometimes, a Wi - Fi connection is ok, sometimes it s not. I pushed usually the strength of the signal much if I move my

  • Wi - Fi on Satellite L655 with Win8

    Hello I use a Satellite L655-12 q, model number short PSK1EE. It works on windows 7 x 64.I have recently upgraded to windows 8 and noticed that the WiFi no longer works. Also flash cards do not appear when I press the Fn key. I reinstall the drivers,