Attachment erron when send an e-mail

We've implemented a page in a portal to allow users send e-mails to support center. We've developed a java component for this purpose. The page, contained in an iView, supplies typical things of an e-mail, attachments box too.
The problem is the attachment. When users send an e-mail without attachment, e-mail is received fine.
But when users send an e-mail with attachment, e-mail is received but empty (without attachment and without descriptions).
I've reviewed the Java Component for sending e-mails, but I can not find the error. Could somebody review this java code to look for the error or give me some idea about this error, please? 
Thank you very much
<b><u>CODE:</u></b>
package ContactUsComponent.utils;
import com.sapportals.portal.prt.component.*;
import com.sapportals.portal.prt.logger.ILogger;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import com.sapportals.htmlb.FileUpload;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.mail.*;
import javax.mail.internet.*;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.*;
public class MailUtils implements IComponentConstants {
     private static ILogger logger = PortalRuntime.getLogger();
     public static void sendMail (IPortalComponentRequest request, String firstName,
                     String lastName, String email,     String subject, String phone, String text, FileUpload file) throws Exception {
          try {          
               //logger.severe("1");
               Properties props = System.getProperties();
               //logger.severe("2");
               props.put("mail.smtp.host", getPropertyPortalApp(request.getComponentContext(),SMTP_SERVER));
               //logger.severe("3");               
               Session session = Session.getDefaultInstance(props, null);
               //logger.severe("4");
               // -- Create a new message --
               Message msg = new MimeMessage(session);
               //logger.severe("5");
               // -- Set the FROM and TO fields --
               msg.setFrom(new InternetAddress(email));
               msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(getPropertyPortalApp(request.getComponentContext(),EMAIL_TO), false));
               //logger.severe("6");
               // -- Set the subject and body text --
               msg.setSubject(getPropertyString(request,"SUBJECT") + subject);
               //logger.severe("7");
               // -- Set some other header information --
               //msg.setHeader("X-Mailer", getPropertyString(request,"X_MAILER"));
               msg.setSentDate(new Date());          
               // Create the message part
                BodyPart messageBodyPart = new MimeBodyPart();
               //logger.severe("8");
               // Fill the message          
               messageBodyPart.setText(createEmailText(request,firstName,lastName,email,subject,phone,text));
               //logger.severe("9");
               Multipart multipart = new MimeMultipart();
               multipart.addBodyPart(messageBodyPart);
               //logger.severe("10");
               // Part two is the attachment
               if ((file != null) && (file.getFile() != null)) {
                    //logger.severe("11");
                    // get the file
                    String mimetype = file.getFile().getContentType();
                    String fileName = file.getFile().getFileName();
                    // If the fileName is empty, don't attach
                    if ((fileName == null) && (fileName.equals(IComponentConstants.EMPTY_STRING))) {
                         FileInputStream fis = null;
                         try {
                              fis = new FileInputStream(file.getFile().getFile().getAbsolutePath());
                         } catch (FileNotFoundException ex) {
                              // TODO: Deal with exception. Show error message to user
                              throw ex;
                         BufferedInputStream bis = new BufferedInputStream(fis);
                         ByteArrayOutputStream baos = new ByteArrayOutputStream();
                         int ch;
                         while ((ch = bis.read()) != -1) {
                           baos.write(ch);
                         //byte[] buffer = baos.toByteArray();
                         DataSource source = new FormDataSource(baos,mimetype);
                         messageBodyPart.setDataHandler(new DataHandler(source));
                         messageBodyPart.setFileName(fileName);                    
                         multipart.addBodyPart(messageBodyPart);
               //logger.severe("20");
               // Put parts in message
               msg.setContent(multipart);
               //logger.severe("21");
               // -- Send the message --
               Transport.send(msg);
          } catch (Exception ex) {
               logger.severe("Exception sending e-mail: " + ex);
               throw ex;
     private static String createEmailText (IPortalComponentRequest request, String firstName, String lastName,
                               String email, String subject, String phone, String text) {
          String emailText = "";
          emailText += "[Abstract] " + subject;
          emailText += "\n[Product] " + getPropertyString(request,"PRODUCT");
          emailText += "\n[Last Name] " + lastName;
          emailText += "\n[First Name] " + firstName;
          emailText += "\n[Work Phone] " + phone;
          emailText += "\n[Account] " + getPropertyString(request,"ACCOUNT");
          emailText += "\n[Long Description] " + text;
          emailText += "\n[Email] " + email;
          emailText += "\n[Status] " + getPropertyString(request,"STATUS");
          emailText += "\n[Priority] " + getPropertyString(request,"PRIORITY");
          emailText += "\n[Source] " + getPropertyString(request,"SOURCE");
          return (emailText);
     public static String getPropertyString (IPortalComponentRequest request, String resource_key) {
          try     {
               ResourceBundle bundle = request.getResourceBundle();
               if (bundle != null) {
                    return (bundle.getString(resource_key));
               return (null);
           } catch (MissingResourceException e) {
               return (e.getMessage());
     /** returns a property from portallapp.xml/iView-Config
@param context
@return
    private static String getPropertyPortalApp (IPortalComponentContext context, String property) {
       return context.getProfile().getProperty(property);

Hi, Dipankar:
Thanks for your reply. But I have no idea about how to group parameter from all uploaded file to "Send an E-Mail in Background with Attachment" CO?
For the situation, I write a background CO program to get all uploaded file (from first three block) and grouping this customized CO parameter with "Send an E-Mail in Background with Attachment" CO.

Similar Messages

  • When sending an e-mail I used to just click on contacts then click on the name or group I wanted to send the e-mail to and move it to the "To" area of the e-mail.  All of a sudden I now get a full screen in "contacts" and can no longer move a name .

    MacBookPro 15
    OS - Yosemite
    Problem area - "Contacts"
    Problem - when sending an e-mail in "Mail" I used to open contacts to get an address.  A small window opened, I clicked on addressee and moved the addressee name to the e-mail.  Can no longer do this because I now get a full screen in Contact.
    Question - how do I get back to the small window in Contact?

    Mike,
    Are any of your other applications going wonky, or is it just Logic?
    I'm afraid I've never heard of this particular problem before, but if it were happening to me the first thing I would do is delete my "com.apple.logic.express.plist" file in Library>Preferences, then repair permissions in Disc Utility, and finally restart my computer.  Then I would launch Logic and see if the problem has been corrected.  It's amazing how much these two steps can accomplish.
    If that doesn't resolve the issue I would launch Logic and go to Preferences>Audio Units Manager to see if all my plug-ins are properly validated.

  • Strange characters when sending messages in Mail 2.1.2

    When sending messages from Mail 2.1.2 , some of the recipients get strange characters when opening my messages
    I use a french keyboard with ponctuations that appears to the recipients as black diamond with ponctuation marks in the middle.
    Is it something from my end?

    Here is some info on the problem. Sending plain text instead of rich text is the easiest thing to try.
    http://homepage.mac.com/thgewecke/woutlook.html

  • Is it possible to adjust the size of the columnes when send alv by mail  ?

    is it possible to adjust the size of the columns when send alv by mail  ?
    i send alv ( list ) by mail  , work fine but all the columns are small and in the
    same size , can i adjust it in the mail   ?
    how to do it in regular alv i know it  .
    LS_FCAT-OUTPUTLEN = 29 .

    is it possible to adjust the size of the columns when send alv by mail  ?
    i send alv ( list ) by mail  , work fine but all the columns are small and in the
    same size , can i adjust it in the mail   ?
    how to do it in regular alv i know it  .
    LS_FCAT-OUTPUTLEN = 29 .

  • When sending an e-mail in cannot remove the names of my contacts under BCC

    When sending an e-mail I put in my contact, under that it is BCC and under that it states, INCLUDE and list more of my contacts.
    How do I remove all the other names listed?

    Moderator, please lock. Original question responded to @ https://support.mozilla.com/en-US/questions/823850

  • How to specify "From" address when sending Outbound e-mail from Siebel

    Hi, when sending an e-mail to Outlook exchange server among all there are 2 fields: Sender and From, where Sender is an address of the profile from which e-mail will be sent and "From" address is the one that will be displayed to the receipient ("From" is not related to any profile and any e-mail address could be specified there).
    My question is how can we specify this "From" address in Siebel while using standard e-mail functionality (Communications Outbound Manager sends data based on created activity record). Client wants to specify any e-mail address regardless ofcommunication profile used (which is only one).

    Hi Mathan,
    Please check sap note
    SAP Note No. 1304146 Email Signatures feature note
    1163250 - How to Create an Email Signature on several rows
    I hope it will solve your issue.PLease mark thread as answerd.
    Best Regards,
    Atul

  • When sending an e-mail with a small attachment, I receive an error "qq#4.3.0 please check message and send again. I can't send the message

    When trying to send an e-mail with small attachment, I get the error message qq#4.3.0 and the message fails.

    Pop or IMAP mail account?
    What version of Thunderbird?
    First try this just in case this a Sent folder issue. Right click on 'Sent' Folder and choose 'Properties' then click on 'Repair Folder', click on OK.
    Close and reopen Thunderbird.
    This will make sure the indexing is correct.
    Try Archiving emails in the Sent folder (Ctrl+A will highlight all Sent emails and display them as conversation - click on 'Archive ' button) and then right click on Sent folder and choose Compact.
    This will get all the old emails into an Archive folder and compact will remove any traces of old deleted sent mail, thus freeing up space.
    It could also be an issue at the server end.

  • How can I set the language when sending an e-mail with attachment - 'Html'?

    "Character Broken"
    I made an ALV program, and this convert to "HTML',  and send an e-mail with this.
    Used Process is:
    DATA: gt_abaplist LIKE TABLE OF abaplist,
          gt_html LIKE TABLE OF w3html,
          doc_chng LIKE sodocchgi1,
          objpack LIKE TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead LIKE TABLE OF solisti1 WITH HEADER LINE,
          mail LIKE TABLE OF solisti1 WITH HEADER LINE,
          reclist LIKE TABLE OF somlreci1 WITH HEADER LINE,
          lv_line TYPE i.
    DELETE FROM MEMORY ID '%_LIST'.
    SUBMIT z_template
       AND RETURN EXPORTING LIST TO MEMORY.
    CALL FUNCTION 'LIST_FROM_MEMORY'
      TABLES
        listobject = gt_abaplist
      EXCEPTIONS
        not_found  = 1
        OTHERS     = 2.
    CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
      TABLES
        html       = gt_html
        listobject = gt_abaplist.
    doc_chng-obj_name   = 'URGENT'.
    doc_chng-sensitivty = 'O'.
    doc_chng-obj_descr  = ' '.
    doc_chng-obj_langu  = '3'.
    objhead-line        = ' '.
    APPEND objhead.
    mail[] = gt_html[].
    DESCRIBE TABLE mail LINES lv_line.
    CLEAR: objpack.
    objpack-transf_bin = 'X'.
    objpack-head_start = 1.
    objpack-head_num   = 0.
    objpack-body_start = 1.
    objpack-body_num   = lv_line.
    objpack-doc_type   = 'htm'.
    objpack-obj_descr  = ' '. 
    objpack-doc_size   = lv_line * 255.
    objpack-obj_langu = '3'.
    APPEND objpack.
    CLEAR: reclist.
    reclist-receiver = 'e-mail address'.
    reclist-rec_type = 'U'.
    APPEND reclist.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        document_data              = doc_chng 
        put_in_outbox              = 'X'
        commit_work                = 'X'
      TABLES
        packing_list               = objpack
        object_header              = objhead
        contents_bin               = mail
        receivers                  = reclist
      EXCEPTIONS
        too_many_receivers         = 1
        document_not_sent          = 2
        document_type_not_exist    = 3
        operation_no_authorization = 4
        parameter_error            = 5
        x_error                    = 6
        enqueue_error              = 7
        OTHERS                     = 8.
    SUBMIT rsconn01 AND RETURN.
    I want to show  this by "Japanese".
    But the character is broken.
    LIke This:
    u01D1u072C          u0205|            u0205u072C          u0508           QC u04B90m
    How can I set the language?  How can I solve "Charancter Broken" ?
    Plesse, let me know.
    Thank you so much.
    Edited by: Jaime White 999 on Nov 21, 2011 8:45 AM
    Edited by: Jaime White 999 on Nov 21, 2011 8:46 AM

    Hi Jaime,
    Are you saying, you are getting junk characters in the email attachment? Then pls check the following. Since you want to send Japanese fonts, please pass language 'J' in both  objpack-obj_langu = '3' & doc_chng-obj_langu  = '3' instead of '3' please replace it with 'J'.
    Another thing which you may have to check is the SCOT device type. As I understand from my basis colleague, this may also affect your attachment fonts since the emails are sent through SCOT. Go to transaction SCOT-> Settings-> Device types for format conversion. Check whether wrong device type is defined for Japanese there. Hope this helps
    Regards,
    Gokul

  • Attachment failure when sending email

    three days ago I detected the problem with Convergence,attachment failure(any type of files) when sending email,the attachment suddenly disappears (confirmed by checking the convergence webmail Sent folder and the recipient only receiving the body text message without the attachment(s)) .However , sending with attachment through mail client software such as Thunderbird is OK . before this problem happened , the system can send email with attachment without any problem . Please help on how can I fix this ?
    the java messaging server details :
    Sun Dir LDAP
    #./iwcadmin -V
    Sun Convergence 1.0-10.01 (built September 6 2009 - 18:29:30)
    Sun Java(tm) System Messaging Server 7.0-3.01 32bit
    on Solaris- Bourne shell
    #uname -srv
    SunOS 5.10 Generic_137137-09

    mattzyzy wrote:
    -all users experiencing the same problem now with Convergence
    I don't see this behaviour with my test Convergence patch 10 install (Comm-Suite-7). I should point out that you need to be running MS7u3 a.k.a. MS7.3-11.01 as per the documentation:
    http://wikis.sun.com/display/CommSuite7/Communications+Suite+7+Component+Products+Release+Notes#CommunicationsSuite7ComponentProductsReleaseNotes-RequirementsforCommunicationsSuite7
    "Communications Suite Component Requirements for Convergence 1 Update 3"
    "Messaging Server - Webmail Server => 7 Update 3"
    -Firefox 3.0 ,3.5 , IE 7,8
    small attachment size 100KB to 400KB - PDF ,MSWORD (DOCX AND DOC), -all the types that work prior to this problem happened .Do the users see the size of the attachment displayed next to the attachment name after uploading it?
    Regards,
    Shane.

  • How can I not show my e-mail address in "from" line when sending out e-mails?

    I don't want to show the e-mail address in the "from" line when I send out e-mails.  Is there a way to hide that?
    Thank you!

    whiskey sour wrote:
    Okay here is where I am at so far and thanks for sticking with me, we may have success eventually! Can you confirm the following:
    1--I Go into the iMac Address Book and click on File/Export/Address Book Archive.
    2--It then asks me where I want to save Address Book and I indicate Desktop.
    3--I then assume I somehow transfer this Desktop file to the iBook--can I just copy the file, email it to the iBook, and paste it into the iBook Desktop?
    Yes
    4--If I'm accurate so far, I then do the same with the iBook Archive and save it
    to the iBook Desktop.
    Yes
    5--NOW I open the iMac archive that is on the iBook desktop and it will ask me if I want to overwrite the existing iBook address book and I indicate Yes and it will then place the iMac address book on the iBook.
    Yes
    6--When and if I want to put the iBook address book back into the iBook I click on the file that is on the iBook Desktop and proceed to put the 'old' iBook address book back in.
    That's it.
    If I am correct on this, another question arises--does this method transfer every email address I use as I notice in Address Book under 'All Contacts' there are some that are missing. I may not have manually added each and every address to my Address Book so maybe that is why some are missing and may not show up in this transfer of Archives? Thanks for your patience Barney.
    That's what I would assume. Like I said, the Archive is really just a copy of the AddressBook folder which contains everything related to Address Book and Mail's previous recipients.
    Now, the Address Book contacts and Mail's previous recipients are different entities--they just share the same storage location. So, if that is what you mean by there are some missing, they should still auto-complete in Mail since the previous recipients also is used for auto-complete.

  • How to set Default text when sending a blank mail from SAP

    Hi all,
    How to add Signature with company logo in the mail body.
    User should see at least one default text (eg; Hi) in the mail body if the sender did not type any text in the mail body when sending a mail from SAP.
    Is it possible to set like this on Subject also.
    Kindly share your ideas.
    Regards,
    Mathan A

    Hi Mathan,
    Please check sap note
    SAP Note No. 1304146 Email Signatures feature note
    1163250 - How to Create an Email Signature on several rows
    I hope it will solve your issue.PLease mark thread as answerd.
    Best Regards,
    Atul

  • Long delay when sending non-btinternet mail

    We are using Outlook Express/Windows mail client, and there is a long long delay when sending mail.
    It just hangs saying "Connecting..." in the status bar. Receiving email has no problems.
    Eventually it sometimes works or sometimes just times out.
    The smtp server is not btinternet/yahoo but our own email server, which we have been using for 10 years. There is no problem pinging the smtp server. e.g. smtp.ourserver.net
    It works without delays on other (non BT) home/business networks.
    We have tried plugging other laptops into this home network and trying to send email (to the same mail server) - same problem.
    It therefore seems to be peculiar to a BT Hub or BT as the ISP.
    The problem seems to have first appeared when an upgrade was made to cater for future fibre optic services.
    Any help would be greatly appreciated.

    Today I started from my Firewire-device with 10.4.11 and had ichat running from there. I chatted with my friend, who is on 10.5.1 - no problems at all. (so my router is not causing the problem, as I thought)
    Starting from 10.5.1 again I opened up Activity Monitor and found this message every 10 secs !
    25.12.07 25.12. 15:18:29 com.apple.launchd[138] (at.obdev.LittleSnitchUIAgent[654]) Exited with exit code: 1
    25.12.07 25.12. 15:18:29 com.apple.launchd[138] (at.obdev.LittleSnitchUIAgent) Throttling respawn: Will start in 10 seconds
    25.12.07 25.12. 15:18:39 com.apple.launchd[138] (at.obdev.LittleSnitchUIAgent[655]) posix_spawnp("/Library/Little Snitch/Little Snitch UIAgent.app/Contents/MacOS/Little Snitch UIAgent", ...): No such file or directory
    I remember that I installed Little snitch some time ago and removed it manually. Then today I run the official uninstaller for it. Still I cannot get rid of this activity. May be it has to do something with the text delay in ichat? How to delete all Little Snitch processes? How can someone find these data?
    Thanks for Feedback

  • Error When sending an e-mail

    Hi,
    I have written a small Function module to send an e-mail. I have used the function module SO_NEW_DOCUMENT_ATT_SEND_API1 and the e-mails are being sent as expected most of the times.
    But some times e-mail transmission fails and I get the following error message( IN SOST  transaction ) ' STILL NO ENTRY IN QUEUE ' (Msg No : 672).
    Can any one of you help me out as to how to resolve this error.Do we need to call an explicit commit after the function call to avoid this.
    Can you please respond ASAP as I am left with only one day for my development.
    I thank you in advance for the support extended.
    Thanks & regards,
    Vamsi Krishna P.

    Hi Hongyan,
    I have gone through the note and tried to make the change to my function module but it did not work.
    Some time it still fails. I really do not understand the probelem in it. Enclosed below is a brief decription of the messsge ' STILL NO ENTRY IN QUEUE'..
    <u><b>Definition</b></u>
    A message was sent from the application. The current status of the message is 'Waiting'. However, no entry exist (yet) in the queue.
    <u><b>Use</b></u>
    This can be a normal interim status of a sent message. Preparations for entering the message in the queue for the SAPconnect send process are complete. As soon as the Persistence Service has put the message into the corresponding database table for the queue, the status changes to 'Waiting'.
    If this status stays the same for too long, an inconsistent state exists. In many cases, the cause of this lies with the sending application. The Persistence Service first writes the data to the database when the application has set an explicit Commit Work. If this is missing, then the message is not put into the queue and is not recorded by the SAPconnect send process. On the send request overview, you can put the message in the queue again using retry, but you must look for the cause of the problem in the sending application itself.
    Another cause of the problem may be that the corresponding entry in the queue was deleted manually before the send process recorded the message.
    I request you to go through this and suggest me for a possible solution.
    Thanks & regards,
    Vamsi Krishna P.

  • Error when sending message(e-mail) from Process Chain ?

    Hello SDN s,
    How ya all ?
    I scheduled a Process Chain with Message option to send it to (U - INternet Address) email ID but it says some error in sending message. What could be the reason ?
    The following is the Job Log Entries....
    30.06.2006 18:05:53 Job started                                                                          00        516         S    
    30.06.2006 18:05:53 Step 001 started (program RSPROCESS, variant &0000000000261, user ID ALEREMOTE)     00        550         S    
    30.06.2006 18:05:54 Hierarchy/attribute change successfully carried out                                RSM        794         I    
    30.06.2006 18:06:00 Document <PV FOR GETTING MESSAGE THROUGH E-MAIL - SUCCE> could not be sent          SO        654         S    
    30.06.2006 18:06:00 Error when sending message                                                        RSRA2        11         S    
    30.06.2006 18:06:01 Job finished                                                                        00        517         S    
    Thanks !!!
    Best Regards....
    Sankar Kumar
    +91 98403 47141

    Hey yes, in that T.Code all the values are 0. What to do to activate that ????????????
                                                                         Duration   Duration 
                             Completed  Error      In transit Waiting    In transit Waiting  
                                                                             hh:mm      hh:mm                                                                               
    B08(100)                        0          0          0          0                                                                               
    FAX Telefax              0          0          0          0       0:00       0:00
         5  INT Internet             0          0          0          0       0:00       0:00                                                                               
    SMTP              0          0          0                  0:00       0:00                                                                               
    X40 X.400                0          0          0          0       0:00       0:00
            RML R/Mail or            0          0          0          0       0:00       0:00
            PAG                      0          0          0          0       0:00       0:00
            PRT                      0          0          0          0       0:00       0:00
    So, how to solve this issue ? how to send e-mails ? what configuration or settings to be done ?
    could u give the steps to do that ? as i am the only one BW guy here !?
    Thanks !!!
    Best Regards....
    Sankar

  • When sending long e-mail, top bar containing the send button goes out of sight, how to send in this situation?

    While typing long NEW e-mail, as the text grows the window moves up and the SEND button disappears below another toolbar at top of screen. How do I send an e-mail when the SEND button is not accessible? I cannot pull the window and send button area down enough to enable the curser to activate it.

    Firefox doesn't do email, it's strictly a web browser.
    If you are using Firefox to access your mail, you are using "web-mail". You need to seek support from your service provider or a forum for that service.
    If your problem is with Mozilla Thunderbird, see this forum for support.
    [https://support.mozillamessaging.com/en-US/home] <br />
    or this one <br />
    [http://forums.mozillazine.org/viewforum.php?f=39]

Maybe you are looking for

  • Magsafe light is dim green and not charging properly

    Hello all, I am hoping that someone could help me out with this. I have a Mackbook unibody from 2008 with the most curent Lion operating system. I recently started having problems with the charing of my laptop. I was using my computer one day to the

  • BP Relationship - Partner Function Assignment not maintained

    During the initial load for CUSTOMER_REL the Partner Function Assignment is not maintained for the Relationship "Usage". We want to default this information based on the Sales Area data of the Sold to party and Partner Function maintain in the ECC KN

  • More items in "recent places" list when attaching documents?

    Hello, I find it very useful to have the "recent places" list when browsing for a file I want to attach to an e-mail. In almost all of the other programs I use, however, the recent places list seems to have about twice as many listed as the Mail prog

  • LabVIEW 7.0 Build Error 26097

    Hi All, Blast from the past here. I am working on resurrecting an old program (I work for a company where our products are in use for 30 to 50 years). I have all of the vis assembled, the computer is a Windows XP running LabVIEW 7.0 professional with

  • Avid uncompressed to FCP

    I have a self-contained quicktime file that was exported from Avid on a PC. The codec is Avid Uncompressed. I have added the codecs to my Quicktime Library, but the file is still not able to be opened in Final Cut. I can open the file now with QT pla