cancel
Showing results for 
Search instead for 
Did you mean: 

Mail Adapter (without attachment)

Former Member
0 Kudos

Dear Experts,

I am using PI 7.31 (single stack) with AAE. Please can you let me know if I can use the mail adapter to send an e-mail without any attachment.

At present, we have 2 options: XIALL and XIPAYLOAD, and in both options mail adapter sends the payload and/or soap message.

The requirement is just to send a (notification) mail without any attachment.

Kind Regards,

MM.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member191435
Contributor
0 Kudos

Hi Murali,

We can send mail without attachment also.

Thanks,

Sreenivas

Former Member
0 Kudos

I raised this blog, and the question is still unanswered.

Former Member
0 Kudos

Hi Murli

By default the mail adapter does not send the data as attachment. You have to choose the option 'keep attachment' in the mail adapter to send  payload data as attachment.

So use option 'XIPAYLOAD' and do not check the 'keep attachment' option. In this case the payload of the PI message will be sent as the content of the email but not as attachment.

Former Member
0 Kudos


Dear Indrajit,

Nice to see you here.

I have tried all these optons. The 'keep attachment' is unchecked, and I am getting the payload attachment in email. The actual requirement is to get a mail notification without attachment, without the payload in mail body. Just a mail with subject.

Is this possible?

Former Member
0 Kudos

Hello,

Use Message Transform bean module with below parameter and then check?

Tranform.ContentDisposition --- inline

Thanks

Amit Srivastava

Former Member
0 Kudos

Check below article where u can find the parameters using which u can send content as mail body

(BTW, if i am not wrong i have already shared this wiki in ur previous post, but it seems that u haven't checked it properly?)

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0964d7c-e66e-2910-24bb-ac535e4a5...

Thanks

Amit Srivastava

Former Member
0 Kudos

Thanks Amit, but the requirement is to get a mail notification without attachment, without the payload in mail body. Just a mail with subject.

Is this possible?

I tried the above bean, but in vain.


Former Member
0 Kudos

Hello,

Tell me one thing, the attachment which is coming in mail adapter is the source message becoz u are doing pass through scenario just for sending notification? right?

I think u can write a custom AM which will suppress the message which is getting transferred to receiver mail adapter + in mail adapter hardcode subject/maild id etc. and then check?

Code:


package com.test;

import java.rmi.RemoteException;

import java.text.SimpleDateFormat;

import java.util.Calendar;

import javax.ejb.EJBException;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

import com.sap.aii.af.lib.mp.module.ModuleContext;

import com.sap.aii.af.lib.mp.module.ModuleData;

import com.sap.aii.af.lib.mp.module.ModuleException;

import com.sap.aii.af.service.auditlog.Audit;

import com.sap.engine.interfaces.messaging.api.Message;

import com.sap.engine.interfaces.messaging.api.MessageKey;

import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;

import com.sap.engine.interfaces.messaging.api.Payload;

import com.sap.engine.interfaces.messaging.api.XMLPayload;

import com.sap.engine.interfaces.messaging.api.auditlog.AuditLogStatus;

/**

* @author amitsrivastava5

*

*/

public class TestBean implements SessionBean {

    /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbActivate()

     */

    @Override

    public void ejbActivate() throws EJBException, RemoteException {

        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbPassivate()

     */

    @Override

    public void ejbPassivate() throws EJBException, RemoteException {

        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)

     * @see javax.ejb.SessionBean#ejbRemove()

     */

    @Override

    public void ejbRemove() throws EJBException, RemoteException {

        // TODO Auto-generated method stub

    }

    /* (non-Javadoc)

     * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)

     */

    @Override

    public void setSessionContext(SessionContext arg0) throws EJBException,

            RemoteException {

        // TODO Auto-generated method stub

    }

    public void ejbCreate() throws javax.ejb.CreateException {

      

    }

    public ModuleData process(ModuleContext mc, ModuleData inputModuleData) 

    throws ModuleException { 

        Object obj = null;

        Message msg = null;

        MessageKey key = null;

        String FileName = "";

        MessagePropertyKey FileKey = null;      

        try {

        obj = inputModuleData.getPrincipalData();

        msg = (Message) obj;

        key = new MessageKey(msg.getMessageId(), msg.getMessageDirection());

          // Returns the main document as XMLPayload. 

    XMLPayload xpld = msg.getDocument(); 

    byte[] b = "".getBytes();

    xpld.setContent(b);

    // Sets the principle data that represents usually the message to be processed 

    inputModuleData.setPrincipalData(msg); 

    }catch (Exception e) { 

    Audit.addAuditLogEntry(key, AuditLogStatus.SUCCESS,    "Module Exception caught:"); 

    ModuleException me = new ModuleException(e); 

    throw me; 

    } 

    return inputModuleData; 

    } 

    } 

Thanks

Amit Srivastava

Former Member
0 Kudos

Hi Murli,

Yes you can send the mail without attachment .

Regards

Venkat

Former Member
0 Kudos

Please can you tell me how?