Package com.google.appengine.api.mail.MailService

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


      URLEncoder.encode(confirmationCode, "UTF-8"));
    String body = String.format("You've been invited to administer an instance of " +
            "YouTube Direct. To accept this invitation, please visit %s", url);
   
    MailService mailService = MailServiceFactory.getMailService();
    Message message = new Message();

    message.setSubject("Invitation to Administer YouTube Direct");
    message.setSender(fromAddress);
    message.setTo(toAddress);
    message.setTextBody(body);
    mailService.send(message);
  }
View Full Code Here


    log.info(
        String.format("Sending photo from PhotoEntry id '%s' to admins...", photoEntry.getId()));
    AdminConfig adminConfig = adminConfigDao.getAdminConfig();

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

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

      message.setSubject("Unable to submit photo to Picasa");
      message.setSender(fromAddress);
      message.setTextBody("YouTube Direct was unable to upload a photo submission to Picasa.\n\n"
          + "There might be a service issue, or your Picasa configuration might be incorrect.\n\n"
          + "The photo in question is attached.");

      BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
      byte[] photoBytes = blobstoreService.fetchData(
          photoEntry.getBlobKey(), 0, photoEntry.getOriginalFileSize() - 1);

      MailService.Attachment photoAttachment =
          new MailService.Attachment(photoEntry.getOriginalFileName(), photoBytes);
      message.setAttachments(photoAttachment);

      mailService.sendToAdmins(message);
      log.info("Email sent to admins.");
    } catch (IOException e) {
      log.log(Level.WARNING, "", e);
View Full Code Here

            "No notification email addresses found in configuration.");
      }
      String[] addresses = addressCommaSeparated.split("\\s*,\\s*");

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

      // Default to the first (or only) address in the recipient list to use
      // as From: header.
      message.setSender(addresses[0]);
      message.setTo(addresses);
      message.setSubject(subject);
      message.setTextBody(body);

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

  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) {
View Full Code Here

                "mail.confirmation.content",
                user.getName(),
                url);
        String from = ApplicationMessage.get("mail.noreply");
        String to = user.getMail().getEmail();
        Message message =
            new Message(
                from,
                to,
                ApplicationMessage.get("mail.confirmation.subject"),
                content);
View Full Code Here

     * @throws Exception
     *
     */
    @Test
    public void mail() throws Exception {
        Message message = new Message();
        String to = "foo@bar.com";
        String sender = "hoge@fuga.com";
        String subject = "subject";
        String body = "body";
        message.setTo(to);
        message.setSender(sender);
        message.setSubject(subject);
        message.setTextBody(body);
        MailServiceFactory.getMailService().sendToAdmins(message);
        assertThat(tester.mailMessages.size(), is(1));
        MailMessage mes = tester.mailMessages.get(0);
        assertThat(mes.getTo(0), is(to));
        assertThat(mes.getSender(), is(sender));
View Full Code Here

     *            ignored.
     * @return a newly created {@link Message} instance containing data from
     *         <code>exchange</code>.
     */
    public Message writeRequest(GMailEndpoint endpoint, Exchange exchange, Message request) {
        Message message = new Message();
        writeFrom(endpoint, exchange, message);
        writeTo(endpoint, exchange, message);
        writeCc(endpoint, exchange, message);
        writeBcc(endpoint, exchange, message);
        writeSubject(endpoint, exchange, message);
View Full Code Here

     *            ignored.
     * @return a newly created {@link Message} instance containing data from
     *         <code>exchange</code>.
     */
    public Message writeRequest(GMailEndpoint endpoint, Exchange exchange, Message request) {
        Message message = new Message();
        writeFrom(endpoint, exchange, message);
        writeTo(endpoint, exchange, message);
        writeSubject(endpoint, exchange, message);
        writeBody(endpoint, exchange, message);
        writeAttachments(endpoint, exchange, message);
View Full Code Here

    public static GMailEndpoint createEndpoint(String endpointUri) throws Exception {
        return (GMailEndpoint)component.createEndpoint(endpointUri);
    }
   
    public static Message createMessage() throws Exception {
        return new Message();
    }
View Full Code Here

     *            ignored.
     * @return a newly created {@link Message} instance containing data from
     *         <code>exchange</code>.
     */
    public Message writeRequest(GMailEndpoint endpoint, Exchange exchange, Message request) {
        Message message = new Message();
        writeFrom(endpoint, exchange, message);
        writeTo(endpoint, exchange, message);
        writeCc(endpoint, exchange, message);
        writeBcc(endpoint, exchange, message);
        writeSubject(endpoint, exchange, message);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.mail.MailService.Message

Copyright © 2018 www.massapicom. 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.