MailSender

Hello
I tried to configure my FileOut Adapter in accordance with the description "How to send Mail from XI with FileOutAdapter". I added the class in the run_adapter.bat but I always get the error:
java.lang.ClassNotFoundException: MailSender
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
Do somebody know this problem ?
Thanks
Christoph Borst

You can do it either in the database or in Java.
It kind of depends on what you know better and what are your exact requirements.
For Java you'll use JavaMail http://java.sun.com/products/javamail/
For the DB you can use UTL_SMTP
http://orafaq.com/scripts/plsql/smtp-att.txt

Similar Messages

  • Using SHeaderFROM in mailsender CC and in receiver determination

    Hi
    I am using a mailsender adapter where I need to send messages from one particular sender adress to one folder and messages from other senders to an other folder.
    In my mailsender communication channel I am using the AF_Modules/PayloadSwapBean module as the message comes as an attachment. In my receiver determination I am using the SHeaderFROM in this fashion:
    SHeaderFROM u2260 8716867999 xxxorg
    SHeaderFROM = 8716867999 xxxorg
    However, that is not working and even though I select the "Set Adapter Specific Message Attributes" in the mailsender communication channel I cannot see the SHeaderFROM value in the ABAP monitor under "DynamicConfiguration".
    What can I do?
    BR Mikael

    Hi,
    you can use UDF in mapping, like this
       //write your code here
         //Fabio Boni:- UDF for generating the mail parameters from & to
      String valueFrom = "XXXXXX.com";
      String Mail_address_to = "XXXXXX.com";
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key1 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Mail",  "THeaderFROM");
    DynamicConfigurationKey key2 = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/Mail",  "THeaderTO");
    DynamicConfigurationKey key3 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    conf.put(key1, valueFrom);
    conf.put(key2, Mail_address_to);
    conf.put(key3,Attachment_name);
      return  "";
    and then in CC put "XHeaderName1" in MailAttributeFrom and "XHeaderName2" in MailAttribute2.
    Flag ASMA e Variable Transport Binding in tab Advanced.
    go through this:
    filling Mail subject , to en from using a user defined function
    Edited by: Fabio Boni on Apr 5, 2011 2:23 PM

  • Problem with Simple MailSend Program

    Pls, help, I am new to the JavaMailApi. My program is trying :) to connect to MailServer via SMTP and SSL protocol. It does not work. I turned on Session debbuging. I got
    "DEBUG SMTP: trying to connect to host "smtp.googlemail.com", port 465, isSSL false".
    what does it mean? Maybe I forgot to set up some properties?
    String host = "smtp.googlemail.com";
    properties.put("mail.host", host);
    properties.put("mail.smtp.auth", "true");
    properties.put("mail.smtp.port", "465");
    properties.put("mail.debug", "true");
    properties.put("mail.smtp.starttls.enable", "true");
    Thx.

    Port 465 is usually not "SMTP with STARTTLS", it's usually
    "SMTP over SSL". YOu probably want to use the "smtps"
    protocol. See SSLNOTES.txt that's included with JavaMail
    for instructions on how to switch the default. Don't forget to
    adjust any property settings as well (e.g., use "mail.stmps.auth"
    instead of "mail.stmp.auth").

  • Creating distribution lists in SAP CRM 5.0 business workplace

    Hi Experts,
    We have CRM 5.0 and I have tried to create distribution lists for
    mailsending.
    After defining a name and a folder (that is then created) for the
    list the recipient list insertion is a following task.
    I can search for partners of different type by F4 help but no
    matter the type of the partner searched - the type that is
    automatically entered to the lists recipents table is "shared
    distribution list". even though the desired type is among others
    in a list other values cannot be selected.
    Please help, is this a setting that can be undone or what might
    be a problem in the procedure that i use in creating a list?
    has anyone else had similar problems?
    Thank You so much,

    i have received an answer from SAP:
    "The reason for the error is a wrong entry in table TBCS_RECIP. To removethis entry, please use the report which is entered in the description
    of note 735795 or delete the wrong entry direct on table TBCS_RECIP.
    After the run of the report or the deletion on table TBCS_RECIP you willnot find further the selection option 'Business Partner' on the F4 help."
    The entry was removed and for Lists business partners cannot be selected at all - as a standard. really sad endeed.

  • How can I implement This? - Via Multiple Threads

    Hi Friends,
    I m getting a list of 4000 emails in an ArrayList. Now I want to put 300 addresses in a mail at a time, and Want to create a new Thread and Send a Mail.
    I want to run 20 threads at a time to do so, Means Each thread is taking 300 addresses from array assigning it to Message and send it. After Sending it should return to ThreadPool.
    Also the 300 addresses should be removed from arraylist.
    Here are code snippet, i m using..
    MailBean.java - A bean which have all the MailProperty and Send Method.
    MailSender.java - It implements Runnable Interface, In its constructor A MailBean Object is Created and in run method it is sending the Mail.
    FileReader.java - It extends ArrayList, it takes a fileName, parse the Emails add email.
    Main.java - Here i want to send mails using ExecutorService class of java.util.concurrent.
    Mailer.java (Main Class)
    public class Mailer {     
         private final FileReader toEmails;
         private ArrayCollection<String> emails ;
         public Mailer(String addressFile){          
              toEmails = new FileCollection(addressFile);
              emails = new ArrayCollection<String>();
                          Here I want to read the 300 emails from toEmails append it in a String and add it to emails ArrayCollection.
        public static void main(String[] args) {
            try{
                 BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(200);
                 Executor e = new ThreadPoolExecutor(50, 50, 1, TimeUnit.SECONDS, queue);
                    if (args.length != 1) {
                         System.err.println("Usage: java ExecutorExample address_file" );
                         System.exit(1);
                  Mailer mailer = new Mailer(args[0]);
                  MailBean bean = new MailBean();
                  bean.setSubject("Mail Bean Test");
                  bean.setMessage("Hi This is a Test Message, Please Ignore this Message");
               /*  I want to run the send mails to all the emails (300 emails per String.) with the Exceutor.
                   Can somebody tell, I want a new object of MailSender for each mail
                   and sendmails
                 System.out.println("Creating workers");
                 for(int i = 0; i < 20; i++)
                     e.execute(new MailSender(bean));
                 System.out.println("Done creating workers");
            }catch(Exception ex){
                 ex.printStackTrace();
    } Can Somebody give me hint, How can we do it?

    The problem is the sound buffer. You may stop the method which dispatch the notes to be played... but not clear your sound card buffer....
    anyway: you should implement it in daemon threads. This way you can control the thread suspend, stop, restart, etc.
    use Thread.sleep(milliseconds);

  • How to set up email notification for custom activities.

    Hi,
    I want to send automated e-mail's in some specific activities, not in all of them.
    Is there any way to disable sending the e-mail particularly on some activities inside a process?
    BPM Version: 10.3.2.
    Build: #101201
    Regards.

    Hi,
    You can send email from any of the automatic activity by using Fuego Mail API.
    Configure the SMTP sever with respect to your project in studio (Project >> Engine >> General Tab >> SMTP Mail Server Name).
    In Enterprise server (Engine >> Click on the engine configured >> Networking Tab >> SMTP Mail Server Name)
    Create a method inside your project for sending email, example sendEmail()
         mail as Mail
         mailContain = Mail()
              mail.from = <"[email protected]">
              mail.recipient = <"[email protected]">
              mailContain.subject = <"Hi">                  
              mail.message = <"Hello">                                                                    
              mail.attachments[0] = MailAttachment(fileName : <>)
         mailSender as MailSender
         mailSender = MailSender(mail)
              send mailSender
       3.  Define a Boolean variable with default value set to FALSE.
       4.  Inside the automatic activity where you want to send email, construct your mail body and set it in the mail.message
       5.  If you want to send email then set the Boolean variable to TRUE and inside the automatic activity check for the variable value.
       6.  If the value set to TRUE, call the sendEmail()
    Hope this help you.
    Regards, Bibhu

  • Why I can Send Mail Here -- Plz Help

    Hi All,
    I m trying to send Mails to multiple users with the MailerBackp.java. But it is trowing some exception in parsing the InternetAddress
    import java.util.*;
    import java.util.concurrent.*;
    public class MailerBackup {
         private final FileCollection to;
         private static ArrayList<String> emails ;
         public MailerBackup(String addressFile){
              to = new FileCollection(addressFile);
              emails = new ArrayList<String>();
              //No of remaining emails.
              int remaining = to.size();
              System.out.println("Remaining is: "+remaining);
              int noOfmailAtATime = 500;
              int counter = remaining/noOfmailAtATime;
              System.out.println("Counter is == "+counter + "   no of Mails at a time =="+noOfmailAtATime);          
              String email= "";     
              int start = 0;
              int end  = 0;
              if(to.size()> noOfmailAtATime){
                   end = noOfmailAtATime;
              }else{
                   end = to.size();
              if(counter>=1){               
                   for(int i=0; i<counter; i++) {     
                        System.out.println("i is : "+i);
                        System.out.println("Start is "+start+" and end is "+end);
                        for(int j=start; j<end; j++ ){
                             email = email + "," +to.get(j);     
                        start = end;                    
                        email = email.substring(1);
                        emails.add(email);
                        email = "";
                        if(i< counter-1){
                             end = end + noOfmailAtATime;     
              System.out.println("End is :"+end);          
              if(end < to.size()){
                   int count = 0;
                   System.out.println("Inside if");
                   for(int i= end; i<to.size(); i++){
                        System.out.println();
                        email = email + "," +to.get(i);
                        count = i;     
                   email = email.substring(1);               
                   emails.add(email);
                   email="";
                   System.out.println("End is =="+count+" and to size is "+to.size());
        public static void main(String[] args) {
            try{
                 BlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(200);
                 ThreadPoolExecutor executor = new ThreadPoolExecutor(50, 50, 1, TimeUnit.SECONDS, queue);
                    if (args.length != 1) {
                         System.err.println("Usage: java ExecutorExample address_file" );
                         System.exit(1);
                  MailerBackup mailer = new MailerBackup(args[0]);
                  MailBean bean = null ;
                  MailSender sender = null;
                 long time = -System.currentTimeMillis();
                 time += System.currentTimeMillis();              
    //Here Emails is an ArrayCollection<String>, where each String consist of
    //multiple comma seperated emails .
                 for(int i = 0; i < emails.size(); i++){
                      bean = new MailBean();
                       bean.setSubject("Mail Bean Test");
                       bean.setMessage("Hi This is a Test Message, Please Ignore this Message");
                       System.out.println(emails.get(i));
                         bean.setTo(emails.get(i));
                         executor.execute(new MailSender(bean));
                 System.out.println(time + "ms");
                  System.out.println("Finished");          
            }catch(Exception ex){
                 ex.printStackTrace();
    }For sending Mails, My MailBeans send method is :
    public Message createMessage(){
             try{              
                  Message msg = new MimeMessage(session);
                   msg.setFrom(InternetAddress.parse(FROM, false)[0]);
                   msg.setHeader("X-Mailer", "VMailer");
                   msg.setSentDate(new Date());
                   if(getTo() != null || getTo() !="")
                   msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(getTo(), false));
                   if(getCc() != null || getCc() !="")
                        msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(getCc(), false));
                   if(getBcc() != null || getBcc() !="")
                        msg.setRecipients(Message.RecipientType.BCC,InternetAddress.parse(getBcc(), false));
                   msg.setSubject(getSubject());
                   msg.setText(getMessage());
                   return msg;                        
             }catch(Exception ex){
                  ex.printStackTrace();
             return null;          
        public void sendMessage(){
             try{
                  Message msg = createMessage();
                  transport.send(msg, msg.getAllRecipients());
             }catch(Exception ex){
                  ex.printStackTrace();
        }Error is while parsing the Mails.
    java.lang.NullPointerException
            at javax.mail.internet.InternetAddress.parse(InternetAddress.java:595)
            at javax.mail.internet.InternetAddress.parse(InternetAddress.java:555)
            at MailBean.createMessage(MailBean.java:123)
            at MailBean.sendMessage(MailBean.java:138)
            at MailSender.run(MailSender.java:11)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)DEBUG: setDebug: JavaMail version 1.4ea
    DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
    DEBUG SMTP: useEhlo true, useAuth true
    DEBUG SMTP: trying to connect to host "email.vsginc.com", port 25, isSSL false
            at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
            at MailBean.sendMessage(MailBean.java:139)
            at MailSender.run(MailSender.java:11)
            at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
    220 email.vsginc.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at  Fri, 7 Sep 2007 09:19:00 -0400
    DEBUG SMTP: connected to host "email.vsginc.com", port: 25

    So what's in FROM?

  • How to enable Sql Dependency OnDataChange event to handle multiple request at a time

    when we work with sql dependency then we work with OnDataChange event and this event notify us regarding data change in table. suppose my application monitor a
    test table by using sql dependency. suppose huge number of data is getting insert and updated in
    test table very frequently. so i do not know how sql dependency
    OnDataChange event can handle this situation because OnDataChange event will fire as many as time data will be change in db table.
    here is my snip for onchange event
    void OnDataChange(object sender, SqlNotificationEventArgs e)
    ((SqlDependency)sender).OnChange -= OnDataChange;
    BBALogger.Write("PartIndexer Service RegisterNotification called end", BBALogger.MsgType.Info);
    if (e.Source == SqlNotificationSource.Timeout)
    MailSend(); // notification mail send
    BBALogger.Write("PartIndexer Service SqlNotificationSource.Timeout error", BBALogger.MsgType.Error);
    Environment.Exit(1);
    else if (e.Source != SqlNotificationSource.Data)
    MailSend(); // notification mail send
    BBALogger.Write("PartIndexer Service SqlNotificationSource.Data", BBALogger.MsgType.Error);
    Environment.Exit(1);
    else if (e.Type == SqlNotificationType.Change)
    StartIndex();
    BBALogger.Write("PartIndexer Service Data changed", BBALogger.MsgType.Info);
    else
    BBALogger.Write(string.Format("Ignored change notification {0}/{1} ({2})", e.Type, e.Info, e.Source), BBALogger.MsgType.Warnings);
    RegisterNotification();
    please help me to design my OnDataChange event such was if data is changed very frequently in test table then
    OnDataChange can handle the situation. OnDataChange event should not be freeze and can log each data change in xml file.
    i am just looking for guidance like how to design OnDataChange as a result it could handle and log data when huge number of user will change data in test table frequently. thanks

    Hi,
    You should be able to delete all nodes selected by an XPath expression... Have a look at this...
    http://docs.oracle.com/cd/E28280_01/dev.1111/e15866/ui_ref.htm#i1290003
    Cheers,
    Vlad

  • Error while using Javamail...pls help me...

    when i am using javamail for sending mail , i am getting error like,
    C:\jdk1.3\bin\mail>java MailSend
    [email protected] [email protected]
    javax.mail.SendFailedException: Sending failed;
    nested exception is:
    javax.mail.MessagingException:
    at javax.mail.Transport.send0(Transport.java:218)
    at javax.mail.Transport.send(Transport.java:80)
    at MailSend.Send(MailSend.java:56)
    at MailSend.main(MailSend.java:73)
    and i define properties like,
    mailProp.put("java", "java");
    where , "java" is my system name, and there is also mail server on my system. and my system is connected with proxy server..
    when i am trying
    mailProp.put("mail.smtp.host", "java");
    then i am getting same type of error...
    so, what is that ? pls help me to solve my error...

    Surely there's more information associated with that MessaginException than
    you've included here.
    Turn on session debugging and run your program again.
    http://java.sun.com/products/javamail/FAQ.html#debug

  • How to find out the cause of "Cannot create JDBC driver"?

    A small Java web application constantly runs into a problem of "Cannot of create JDBC driver of class 'org.postgresql.Driver' for connect URL 'jdbc:postgresl://localhost:5432/myapp'". The problem still exists after upgrading the driver. After recycling the server, this problem will be resolved. It, however, will come back after a while.
    Any suggestions to solve this problem?
    Thanks a lot.

    jschell wrote:
    vwuvancouver wrote:
    Any suggestions to solve this problem?To start with get the full and complete stack trace.
    However since it is an intermittent problem there are only two possibilities
    1. You have some code that is written correctly and some that is not.
    2. It is a resource not code usage problem. Such as that you are not closing all result sets, statements and connections.Here is related log messages:
    2009-04-30 09:29:21,386  INFO XmlWebApplicationContext:601: - Closing application context [WebApplicationContext for namespace 'mybookmarks-servlet']
    2009-04-30 09:29:21,387  INFO DefaultListableBeanFactory:273: - Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,viewResolver,localeResolver,untapedUrlMapping,urlMapping,localeChangeInterceptor,errorsController,myBookmarksController,bookmarkController,reminderController,accountController,userControllerMethodResolver,userFormController,searchFormController,directoryController,directoryControllerMethodResolver,secureHandlerMapping,signonInterceptor,addBookmarkFromListFormController,addBookmarkFormController,bookmarkValidator,editWebSiteEntryFormController,addCommentFormController,reminderFormController,genericReminderFormController,alterReminderDateFormController,contactFormController,invitationFormController,propertyConfigurer,mailSender]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [propertyConfigurer,mailSender,userValidator,bookmarkService,dataSource,sessionFactory,transactionManager,accountDao,categoryDao,webSiteDao,siteVisitDao,reminderDao,commentDao,bookmarkDao]; root of BeanFactory hierarchy}
    2009-04-30 09:29:21,388  INFO GenericWebApplicationContext:601: - Closing application context [org.springframework.web.context.support.GenericWebApplicationContext;hashCode=15954072]
    2009-04-30 09:29:21,389  INFO DefaultListableBeanFactory:273: - Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [modelView,addCommentFormView,discoveryFormView,mostVisitedView,bookmarkListView,contactFormView,actionResultView,accountView,reminderFormView,reminderDateFormView,searchList2View,helpView,homeView,taggedListView,searchFormView,reminderListView,webSiteEntryFormView,reminderForm2View,categorizedList2View,invitationFormView,myHomeView,taggedList2View,contactListView,aboutView,bookmarkFormView,bookmarkForm2View,newEntries2View,categorizedListView,signinFormView,accountActionResultView,userFormView,siteActionResultView,searchListView,mostVisited2View,newEntriesView,errorHttp404View]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,viewResolver,localeResolver,untapedUrlMapping,urlMapping,localeChangeInterceptor,errorsController,myBookmarksController,bookmarkController,reminderController,accountController,userControllerMethodResolver,userFormController,searchFormController,directoryController,directoryControllerMethodResolver,secureHandlerMapping,signonInterceptor,addBookmarkFromListFormController,addBookmarkFormController,bookmarkValidator,editWebSiteEntryFormController,addCommentFormController,reminderFormController,genericReminderFormController,alterReminderDateFormController,contactFormController,invitationFormController,propertyConfigurer,mailSender]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [propertyConfigurer,mailSender,userValidator,bookmarkService,dataSource,sessionFactory,transactionManager,accountDao,categoryDao,webSiteDao,siteVisitDao,reminderDao,commentDao,bookmarkDao]; root of BeanFactory hierarchy}
    2009-04-30 09:29:21,391  INFO GenericWebApplicationContext:601: - Closing application context [org.springframework.web.context.support.GenericWebApplicationContext;hashCode=29369879]
    2009-04-30 09:29:21,392  INFO DefaultListableBeanFactory:273: - Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [modelView,addCommentFormView,discoveryFormView,mostVisitedView,bookmarkListView,contactFormView,accountView,actionResultView,reminderFormView,reminderDateFormView,searchList2View,helpView,homeView,configView,taggedListView,searchFormView,reminderListView,webSiteEntryFormView,reminderForm2View,categorizedList2View,invitationFormView,taggedList2View,myHomeView,contactListView,aboutView,bookmarkFormView,bookmarkForm2View,newEntries2View,categorizedListView,signinFormView,accountActionResultView,userFormView,siteActionResultView,searchListView,mostVisited2View,newEntriesView,errorHttp404View]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,viewResolver,localeResolver,untapedUrlMapping,urlMapping,localeChangeInterceptor,errorsController,myBookmarksController,bookmarkController,reminderController,accountController,userControllerMethodResolver,userFormController,searchFormController,directoryController,directoryControllerMethodResolver,secureHandlerMapping,signonInterceptor,addBookmarkFromListFormController,addBookmarkFormController,bookmarkValidator,editWebSiteEntryFormController,addCommentFormController,reminderFormController,genericReminderFormController,alterReminderDateFormController,contactFormController,invitationFormController,propertyConfigurer,mailSender]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [propertyConfigurer,mailSender,userValidator,bookmarkService,dataSource,sessionFactory,transactionManager,accountDao,categoryDao,webSiteDao,siteVisitDao,reminderDao,commentDao,bookmarkDao]; root of BeanFactory hierarchy}
    2009-04-30 09:29:21,394  INFO XmlWebApplicationContext:601: - Closing application context [Root WebApplicationContext]
    2009-04-30 09:29:21,395  INFO DefaultListableBeanFactory:273: - Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [propertyConfigurer,mailSender,userValidator,bookmarkService,dataSource,sessionFactory,transactionManager,accountDao,categoryDao,webSiteDao,siteVisitDao,reminderDao,commentDao,bookmarkDao]; root of BeanFactory hierarchy}
    2009-04-30 09:29:21,396  INFO LocalSessionFactoryBean:184: - Closing Hibernate SessionFactory
    2009-04-30 09:29:21,397  INFO SessionFactoryImpl:767: - closing
    2009-04-30 09:29:21,408  WARN JDBCExceptionReporter:71: - SQL Error: 0, SQLState: null
    2009-04-30 09:29:21,410 ERROR JDBCExceptionReporter:72: - Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'jdbc:postgresql://localhost:5432/homepage'
    2009-04-30 09:29:21,411  WARN JDBCExceptionReporter:71: - SQL Error: 0, SQLState: null
    2009-04-30 09:29:21,414 ERROR JDBCExceptionReporter:72: - Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'jdbc:postgresql://localhost:5432/homepage'
    ...Your analysis seems very reasonable. As the above log messages, this application is built on Hibernate and Spring. All back end is taken care by Hibernate. I don't have a direct control on it. I should ask the Hibernate crowd about this issue. The Hibernate forum is still down at this moment.
    Edited by: vwuvancouver on Apr 30, 2009 1:12 PM

  • How to determine the size of a flat file attachment in a mail sender cc?

    Hi
    I use PI 7.11
    I have a scenario where a flat file attachment is being picked up by a MailSender adapter and if the size of the attached flat file is larger that 500 bytes the receiver is A and if the attachment is less that 500 bytes the receiver is B.
    I have checked the Context Object list in the Conditions section of Receiver Determination, and it seems, that only the file adapter allows for validation on the file size.
    I contemplated an extended receiver determination but the attachment is a flat file which just needs to be passed thru without being converted to an XML document, so my source document is not of XML format.
    An other but not very nice way would be to use an intermediate folder to drop the attachment in and from there use a file sender adapter and thus get access to the filesize attribute in my receiver determination, but I would like to avoid this.
    Any suggestions?
    BR MIkael

    Hi
    I have decided to make a module, where I plan to place the size of the attachment in the Dynamic Configuration variable "ProcessStep", but to my surprise, it seems that all the context objects in the receiver determination condition section are of type String and hence it is not possible to make a condition where I test for whether the value is smaller than say 500!? Only equal, NOT equal and LIKE are available (EX seems to be disabled as this probably only works in an xpath.
    Would one way be to use the xpath expression like this ns1:Main\ProcessStep < 500 where ns1: http://sap.com/xi/XI/System?
    MIkael

  • Java Mapping: payload as mail attachment and dynamic file name .

    Hi,
    I have written this piece of java code.
    The code includes XPATH for fetching dynamic filename and the copysource( in, out ) to copy the content of payload as mail attchment.
    The code seems to work fine, when either of the functionality is implemented.
    but when both are implemented together ie parsing for xpath then again parsing to copy payload, then it doesnt executes the latter path i.e the payload is not fetched in the attachment.
    public class MailPackage implements StreamTransformation {
      public void setParameter(Map map) {
      public void execute(InputStream in, OutputStream out)
              throws StreamTransformationException {
      String mailSubject = "test mail";
      String mailSender = "aaaaaaaa";
      String mailReceiver = "[email protected]";
      String attachmentName = null;
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = null;
      factory.setNamespaceAware(false);
    factory.setValidating(false);
         try {
              builder = factory.newDocumentBuilder();
         Document doc = null;
          doc = builder.parse(in);
              String XPATH ="/*/Invoice/InvoiceHeader/InvoiceNumber/text()";
              Node fieldValueNode = org.apache.xpath.XPathAPI.selectSingleNode(doc,XPATH);
              System.out.print(fieldValueNode);
              attachmentName = fieldValueNode.getNodeValue() +".xml";
      String boundary = "--";
      String mailContent = "This is a sample file";
      String CRLF = "\r\n";
        //     create XML structure of mail package
        String output ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
               + "<ns:Mail xmlns:ns=\"http://sap.com/xi/XI/Mail/30\">"
               + "<Subject>" + mailSubject     + "</Subject>"
               + "<From>" + mailSender     + "</From>"
               + "<To>" + mailReceiver     + "</To>"
               + "<Content_Type>multipart/mixed; boundary=\"" + boundary + "\"</Content_Type>"
               + "<Content>";
        out.write(output.getBytes());
        // create the declaration of the MIME parts
        //First part
        output = "--" + boundary + CRLF
               + "Content-Type: text/plain; charset=UTF-8" + CRLF
               + "Content-Disposition: inline" + CRLF + CRLF
               + mailContent + CRLF
        //Second part
        + "--" + boundary + CRLF
        + "Content-Type: application/xml; name=" + attachmentName + CRLF
        + "Content-Disposition: attachment; filename=" + attachmentName + CRLF + CRLF;
        out.write(output.getBytes());
        //Source is taken as attachment
        copySource(in, out);
        out.write("</Content></ns:Mail>".getBytes());
      } catch (Exception ie) {
        throw new StreamTransformationException(ie.getMessage());
    protected static void copySource(InputStream in, OutputStream out)throws IOException {
        byte[] bbuf = new byte[in.available()];
        int bblen = in.read(bbuf);
       if (!(bblen < 0)) {
          String sbuf = new String(bbuf);
           //replace all control characters with escape sequences
         sbuf = sbuf.replaceAll("&", "&amp;");
         sbuf = sbuf.replaceAll("\"", "&quot;");
         sbuf = sbuf.replaceAll("'", "&apos;");
        sbuf = sbuf.replaceAll("<", "&lt;");
        sbuf = sbuf.replaceAll(">", "&gt;");
        out.write(sbuf.getBytes());
    Povide your suggestions.

    Hi,
    This is the sample o/p that I get by opening the mail attachment using notepad.
    <?xml version="1.0" encoding="UTF-8"?>
    <InvoiceTransmission><InvoiceTransmissionHeader><InvoiceCreationDate>2008-12-03T00:00:00</InvoiceCreationDate><Version>2.0.2</Version></InvoiceTransmissionHeader><Invoice><InvoiceHeader><CustomerEntityID>LH</CustomerEntityID><IssuingEntityID>009140559</IssuingEntityID><InvoiceNumber>913353669</InvoiceNumber><InvoiceIssueDate>2008-12-03</InvoiceIssueDate><InvoiceType InvoiceTransactionType="OR">INV</InvoiceType><InvoiceDeliveryLocation>aaa</InvoiceDeliveryLocation><TaxInvoiceNumber>Not Applicable</TaxInvoiceNumber><InvoiceCurrencyCode>USD</InvoiceCurrencyCode><InvoiceTotalAmount>517174.63</InvoiceTotalAmount><InvoiceIDDetails InvoiceIDType="BT"><InvoiceIDVATRegistrationNumber>0000000000</InvoiceIDVATRegistrationNumber><InvoiceIDName1>aaaaaaaaaaaaaaa</InvoiceIDName1><InvoiceIDName2>bbbbbbHKG</InvoiceIDName2><InvoiceIDCity>ccccccccc ccccc</InvoiceIDCity><InvoiceIDCountryCode>HK</InvoiceIDCountryCode></InvoiceIDDetails><InvoiceIDDetails InvoiceIDType="II"><InvoiceIDVATRegistrationNumber>0000000000</InvoiceIDVATRegistrationNumber><InvoiceIDName1>eeeeeeee</InvoiceIDName1><InvoiceIDName2>PAY BY WIRE TRANSFER</InvoiceIDName2><InvoiceIDCity>fffffffffffffff, NA</InvoiceIDCity><InvoiceIDCustomField ID="1"><InvoiceIDCustomFieldDescription>Company Registration Number</InvoiceIDCustomFieldDescription><InvoiceIDCustomFieldValue>0000000000</InvoiceIDCustomFieldValue></InvoiceIDCustomField></InvoiceIDDetails></InvoiceHeader><SubInvoiceHeader><InvoiceLine><ItemNumber>001</ItemNumber><ItemQuantity><ItemQuantityType>IN</ItemQuantityType><ItemQuantityFlag>GR</ItemQuantityFlag><ItemQuantityQty>28134.000</ItemQuantityQty><ItemQuantityUOM>USG</ItemQuantityUOM></ItemQuantity><ItemQuantity><ItemQuantityType>DL</ItemQuantityType><ItemQuantityFlag>GR</ItemQuantityFlag><ItemQuantityQty>106498.775</ItemQuantityQty><ItemQuantityUOM>LT</ItemQuantityUOM></ItemQuantity><ItemDeliveryReferenceValue ItemDeliveryReferenceType="DTN">590365</ItemDeliveryReferenceValue><ItemDeliveryReferenceValue ItemDeliveryReferenceType="!
    ARN">DAL
    CH</ItemDeliveryReferenceValue><ItemDeliveryReferenceValue ItemDeliveryReferenceType="FNO">mmmmmmmmm</ItemDeliveryReferenceValue><ItemDeliveryLocation>pppp</ItemDeliveryLocation><ItemReferenceLocalDate
    If you notice the problem is, the undesired "exclamation mark" that gets added in some fields before the actual value.
    In the above case.. look at "ItemDeliveryReferenceType="! ARN">DAL"
    the exclamation mark before value "ARN is unwanted, which leads to improper XML formation.
    Cant figure out why is this coming.
    Regards,
    Faria Mithani

  • Mail 2 File scenario - problems with attachments in file receiver

    Hi experts,
    I want to receive PDF documents via email and send them thru file adapter. Now I have some trouble with the attachments. I have configured my mailsender as follows:
    localejbs/AF_Modules/PayloadSwapBean    TRANSFORM
    sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean    mail
    Modules:
    TRANSFORM       swap.keyName   Content-Disposition
    TRANSFORM     swap.keyName     Content-Description
    TRANSFORM       swap.keyValue     MailAttachment-1
    TRANSFORM       swap.keyValue     attachment;filename="MailAttachment-1.pdf"
    Now what modules do I have to use in my file receiver when I want to write the PDF-attachment to my directory? I already tried a lot and referred to many blogs but nothing really worked. I only get my header information in the output file.
    Any ideas?
    Thanks in advance.
    Best regards.
    Oliver.

    Hi
    Check this blogs
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417700)ID1810608850DB10913328217115658435End?blog=/pub/wlg/1685
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417700)ID1810608850DB10913328217115658435End?blog=/pub/wlg/2849
    Regards
    Ramesh

  • Read multi-tabbed excel file attachments from Sender Mail Adapter.

    There is a need to read excel attachments from incoming email to a
    mailbox. We know we can use Sender Mail adapter to easily read .xml, .txt
    or .csv attachments.
    For excel attachments we know from SDN that you have to write
    adapter modules to handle excel. However the excel file we need to read has
    multiple worksheets(tabs) and data may be contained in any of them.
    Is it possible to use SAP XI Mailsender adapter to read such a file as an attachment? What kind of module development would we need for this? I am not much of a Java programmer so examples or links to other documentation would help.
    Thanks,
    Rudra

    Rudra,
    Use Java Mapping.  There is a free java api available called JExcelAPI to achieve this. 
    Shabarish's blog describes about this.  This might be helpful to you
    /people/shabarish.vijayakumar/blog/2009/04/05/excel-files--how-to-handle-them-in-sap-xipi-the-alternatives

  • Error in configuring Mail Adapter

    Hello Friends,
    I am working in XI 2.0
    I am trying to configure the Outbound file adapter for sending the Mail.
    and i configure my adapter as
    File adapter java class
    classname=com.sap.aii.messaging.adapter.ModuleXMB2File
    mode=XMB2FILE
    ##Adress for XMB endpoint
    XMB.httpPort=8220
    XMB.httpService=/mailSender
    ##File Adapter specific parameters
    file.createDir=1
    file.targetDir=e:/oraclejdbc/mail
    file.targetFilename=mail.txt
    #file.writeMode=append
    file.writeMode=overwrite
    uncomment and adjust parameters for using a dispatcher ***
    Dispatcher.class=com.sap.aii.messaging.adapter.ConversionDispatcher
    Dispatcher.namespace=namespace1
    namespace1.ConversionDispatcher.logPayload=true
    ##namespace1.MailClient.contentType=text/html
    namespace1.Service.1=MailClient
    namespace1.MailClient.class=MailSender
    namespace1.MailClient.smtpHost=POWAI
    namespace1.MailClient.smtpPort=25
    namespace1.MailClient.from=[email protected]
    namespace1.MailClient.to=[email protected]
    namespace1.MailClient.subject=NewXI Message
    namespace1.MailClient.contentType=text/html
    And when I am trying to start the adapter engine it gives me error as
    Tue Nov 23 10:46:47 IST 2004 *****
    10:46:47 (4115): File adapter listener initialized successfully
    10:46:47 (8200): Conversion dispatcher 2.0.0904 initializing
    10:46:47 (4024): Attempt to initialize file adapter failed with
    java.lang.NullPointerException
    10:46:47 : Error(s) in adapter configuration parameters found:
    10:46:47 (4108): Unable to start file adapter (not initialized)
    If any one know please help me to solve this problem.
    Thanks & Regards,
    Gaurav Jain

    Could you check, if the file Mail.jar is installed correctly in your Adapter Framework folder and the starting program of the Adapter Framework (e.g. runadapter.bat or install_service.bat) is enhanced with this library file?
    Regards
    Stefan

Maybe you are looking for