Skip to Content
author's profile photo Former Member
Former Member

Portal mail service "from" specification

Hello all,

I am using Portal mail service but if I do not specify te from field it did not work:

ISendMailService sendMailSvc = (ISendMailService) ResourceFactory.getInstance().getServiceFactory().getService(ISendMailService.SERVICE_ID);

ISendMailItem mailItem = sendMailSvc.createMailItem();

mailItem = sendMailSvc.createMailItem();

mailItem.setContent(content);

mailItem.setSubject(subject);

mailItem.setMimeType(type);

mailItem.setTo(to);

mailItem.setFrom("generic@hotmail.com");

sendMailSvc.sendMail(mailItem, ep5User);

By now I am using the same user registered inside portal for notifications but as I did not find a way to read this configuration I am fixing the email account inside my program and this is something I want to avoid.

Does anyone know if there is a way to read what is the email account specified in Portal for notification or if there is a way to ommit the specification of setFrom.

Regards,

Mauricio

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Apr 25, 2006 at 01:55 PM

    Hi Mauricio,

    Try setting the <i>From</i> to the string "anonymous".

    Hope that helps,

    Yoav.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2006 at 05:09 PM

    Hi Maurcio, have you solved the problem?

    I want to use the mailing service from a basic form, a form with two fields and a send button,

    What references are needed to use the mailing service?

    What kind of project or component is the best to do the form?

    Thanks in advanced.

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Optima,

      The code I have is in Web Dynpro project, I have no experience in portal JSP Dynpro to tell you if this is better than WD for this case, what I can tell is that in WD it is very easy to be done.

      The required references are:

      bc.rf.framework_api.jar

      bc.rf.global.service.notificator_api.jar

      bc.sf.framework_api.jar

      bc.util.public_api.jar

      coll.appl.gw.srvcmail_api.jar

      coll.shared.gw_api.jar

      kmc.util.core_api.jar

      public void onActionSendEmail(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

      {

      //@@begin onActionSendEmail(ServerEvent)

      //Prepare user

      IUser ep5User = null;

      String message;

      IWDMessageManager messageMgr = wdComponentAPI.getMessageManager();

      try {

      IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

      com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();

      //Create an ep5 user from the retrieved user

      ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);

      } catch (WDUMException e) {

      message = e.getLocalizedMessage() + " (WDUMException)";

      messageMgr.reportException(message,true);

      } catch (UserManagementException e) {

      message = e.getLocalizedMessage() + " (UserManagementException)";

      messageMgr.reportException(message,true);

      }

      //Send the email

      try {

      ISendMailService sendMailSvc = (ISendMailService) ResourceFactory.getInstance().getServiceFactory().getService(ISendMailService.SERVICE_ID);

      ISendMailItem mailItem = sendMailSvc.createMailItem();

      mailItem = sendMailSvc.createMailItem();

      messageMgr.reportSuccess("linha 1");

      mailItem.setContent(this.getContent());

      mailItem.setSubject("Session Registration");

      mailItem.setMimeType("text/html");

      messageMgr.reportSuccess("linha 2");

      mailItem.setTo("mauricio@mail.com");

      IChannel channel = ChannelFactory.getInstance().getChannel(ChannelFactory.EMAIL);

      INotificatorService notificatorSvc = (INotificatorService) ResourceFactory.getInstance().getServiceFactory().getService(INotificatorService.NOTIFICATOR_SERVICE);

      //notificatorSvc.getDefaultFromAddress(channel);

      mailItem.setFrom(notificatorSvc.getDefaultFromAddress(channel));

      messageMgr.reportSuccess(ep5User.getId());

      sendMailSvc.sendMail(mailItem, ep5User);

      messageMgr.reportSuccess("linha 4");

      } catch (ResourceException e) {

      message = e.getLocalizedMessage() + " (ResourceException)";

      messageMgr.reportException(message,true);

      } catch (GroupwareException e) {

      message = e.getLocalizedMessage() + " (GroupwareException)";

      messageMgr.reportException(message,true);

      } catch (WcmException e) {

      message = e.getLocalizedMessage() + " (WcmException)";

      messageMgr.reportException(message,true);

      }

      //@@end

      }

      Regards,

      Mauricio

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.