Examples of MailService


Examples of com.google.appengine.api.mail.MailService

  private void sendUserModerationEmail(String toAddress, String subject, String body) {
    try {
      AdminConfig adminConfig = adminConfigDao.getAdminConfig();

      MailService mailService = MailServiceFactory.getMailService();
      Message message = new Message();

      String fromAddress = adminConfig.getFromAddress();
      if (util.isNullOrEmpty(fromAddress)) {
        throw new IllegalArgumentException("No from address found in configuration.");
      }

      message.setSender(fromAddress);
      message.setTo(toAddress);
      message.setSubject(subject);
      message.setTextBody(body);

      mailService.send(message);
    } catch (IOException e) {
      log.log(Level.WARNING, "", e);
    } catch (IllegalArgumentException e) {
      log.log(Level.WARNING, "", e);
    }
View Full Code Here

Examples of com.google.appengine.api.mail.MailService

    @Override
    @SuppressWarnings("unchecked")
    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        OutboundBinding binding = resolveAndRemoveReferenceParameter(
                parameters, "outboundBindingRef", OutboundBinding.class, new GMailBinding());
        MailService service = resolveAndRemoveReferenceParameter(
                parameters, "mailServiceRef", MailService.class, MailServiceFactory.getMailService());
        GMailEndpoint endpoint = new GMailEndpoint(uri, remaining);
        endpoint.setOutboundBinding(binding);
        endpoint.setMailService(service);
        return endpoint;
View Full Code Here

Examples of com.google.appengine.api.mail.MailService

  private static final Logger logger = Logger.getLogger(GbMailService.class.getName());

  public static void sendMail(Email email, long controlId, String message) {

    MailService mailService = MailServiceFactory.getMailService();
    Message message1 = new Message();
    message1.setTo(email.getEmail());
    message1.setSubject("The task no [" + controlId + "]" + message);
    message1.setSender("gobo-tools@"
      + ApiProxy.getCurrentEnvironment().getAppId()
      + ".appspotmail.com");
    message1.setTextBody("The task no [" + controlId + "]" + message);
    try {
      mailService.send(message1);
    } catch (IOException e) {
      logger.warning(e.getMessage());
    }
  }
View Full Code Here

Examples of com.google.appengine.api.mail.MailService

        if (request.getServerPort() != 80) {
            b.append(":").append(request.getServerPort());
        }
        b.append("/minutes?download=").append(blobKey.getKeyString());
        message.setTextBody(b.toString());
        MailService mailService = MailServiceFactory.getMailService();
        mailService.send(message);
        response.setStatus(HttpServletResponse.SC_NO_CONTENT);
        return null;
    }
View Full Code Here

Examples of com.google.appengine.api.mail.MailService

        if (request.getServerPort() != 80) {
            b.append(":").append(request.getServerPort());
        }
        b.append("/minutes.html?minutes=").append(keyString);
        message.setTextBody(b.toString());
        MailService mailService = MailServiceFactory.getMailService();
        mailService.sendToAdmins(message);
    }
View Full Code Here

Examples of es.devel.mail.MailService

    }

    @Test(expected = MailServiceException.class)
    public void testSendMailWithNoRecipients() throws Exception {
        //Arrange
        MailService mailService = new MailServiceImpl(this.sender);

        //Act
        mailService.sendMail(null, "sender@domain.com", "Sender name", "The subject", "The body");

        //Assert
        fail("Exception should be thrown");
    }
View Full Code Here

Examples of es.devel.mail.MailService

    }

    @Test(expected = MailServiceException.class)
    public void testSendMailWithNoSenderEmail() throws Exception {
        //Arrange
        MailService mailService = new MailServiceImpl(this.sender);

        //Act
        mailService.sendMail(new String[2], "", "Sender name", "The subject", "The body");

        //Assert
        fail("Exception should be thrown");
    }
View Full Code Here

Examples of es.devel.mail.MailService

    }

    @Test(expected = MailServiceException.class)
    public void testSendMailWithNoSenderName() throws Exception {
        //Arrange
        MailService mailService = new MailServiceImpl(this.sender);

        //Act
        mailService.sendMail(new String[2], "sender@domain.com", null, "The subject", "The body");

        //Assert
        fail("Exception should be thrown");
    }
View Full Code Here

Examples of net.sf.jportlet.service.mail.MailService

            body.append( "Here is your requested password\n" );
            body.append( " Login: " + u.getId(  ) + "\n" );
            body.append( " Password: " + u.getPassword(  ) + "\n\n" );

            /* Send the message */
            MailService mailer = ( MailService ) ctx.getService( MailService.NAME );
            mailer.send( null, new Address[] { new InternetAddress( u.getEmail(  ) ) }, subject, body.toString(), MailService.MIME_TEXT );
        }
        catch ( UserNotFoundException u )
        {
            ctx.getLog(  ).warn( email + " not found", u );
        }
View Full Code Here

Examples of org.exoplatform.services.mail.MailService

        public void execute(Event<UIForgetPassword> event) throws Exception {
            UIForgetPassword uiForm = event.getSource();
            UILogin uilogin = uiForm.getParent();
            WebuiRequestContext requestContext = event.getRequestContext();
            PortalRequestContext portalContext = PortalRequestContext.getCurrentInstance();
            MailService mailSrc = uiForm.getApplicationComponent(MailService.class);
            OrganizationService orgSrc = uiForm.getApplicationComponent(OrganizationService.class);
            String userName = uiForm.getUIStringInput(Username).getValue();
            String email = uiForm.getUIStringInput(Email).getValue();
            uiForm.reset();

            User user = null;

            String tokenId = null;

            // User provided his username
            if (userName != null) {
                user = orgSrc.getUserHandler().findUserByName(userName);
                if (user == null) {
                    requestContext.getUIApplication().addMessage(
                            new ApplicationMessage("UIForgetPassword.msg.user-not-exist", null));
                    return;
                }
            }

            // User provided his email address
            if (user == null && email != null) {
                Query query = new Query();
                // Querying on email won't work. PLIDM-12
                // Note that querying on email is inefficient as it loops over all users...
                query.setEmail(email);
                PageList<User> users = orgSrc.getUserHandler().findUsers(query);
                if (users.getAll().size() > 0) {
                    user = users.getAll().get(0);
                } else {
                    requestContext.getUIApplication().addMessage(
                            new ApplicationMessage("UIForgetPassword.msg.email-not-exist", null));
                    return;
                }
            }

            email = user.getEmail();

            // Create token
            RemindPasswordTokenService tokenService = uiForm.getApplicationComponent(RemindPasswordTokenService.class);
            Credentials credentials = new Credentials(user.getUserName(), "");
            tokenId = tokenService.createToken(credentials);

            String portalName = URLEncoder.encode(Util.getUIPortal().getName(), "UTF-8");

            ResourceBundle res = requestContext.getApplicationResourceBundle();
            String headerMail = "headermail";
            String footerMail = "footer";
            try {
                headerMail = res.getString(uiForm.getId() + ".mail.header") + "\n\n"
                        + res.getString(uiForm.getId() + ".mail.user") + user.getUserName() + "\n"
                        + res.getString(uiForm.getId() + ".mail.link");
                footerMail = "\n\n\n" + res.getString(uiForm.getId() + ".mail.footer");
            } catch (MissingResourceException e) {
                log.error(e.getMessage(), e);
            }
            HttpServletRequest request = portalContext.getRequest();
            String host = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
            String activeLink = host + requestContext.getRequestContextPath() + "/public/" + portalName + "?"
                    + ComponentURL.PORTAL_COMPONENT_ID + "=UIPortal&portal:action=RecoveryPasswordAndUsername&tokenId="
                    + tokenId;
            String mailText = headerMail + "\n" + activeLink + footerMail;
            try {
                mailSrc.sendMessage(res.getString("UIForgetPassword.mail.from"), email,
                        res.getString("UIForgetPassword.mail.subject"), mailText);
            } catch (Exception e) {
                requestContext.getUIApplication().addMessage(
                        new ApplicationMessage("UIForgetPassword.msg.send-mail-fail", null));
                requestContext.addUIComponentToUpdateByAjax(uilogin);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.