예제 #1
1
  public static void sendMail(String mailMessage) {

    String to = "*****@*****.**";
    String from = "FlotaWeb";
    String host = "mail.arabesque.ro";

    Properties properties = System.getProperties();
    properties.setProperty("mail.smtp.host", host);

    Session session = Session.getDefaultInstance(properties);

    try {
      MimeMessage message = new MimeMessage(session);

      message.setFrom(new InternetAddress(from));

      message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));

      message.setSubject("Distributie");

      message.setText(mailMessage);

      Transport.send(message);

    } catch (MessagingException e) {
      logger.error(Utils.getStackTrace(e));
    }
  }
예제 #2
0
  public void SendEmail(String email, String contestToken) {
    String to = email;
    String from = "Tyumen_ACM_Society";
    String host = "smtp.gmail.com";
    String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
    Properties props = System.getProperties();
    props.setProperty("mail.smtp.host", host);
    props.put("mail.stmp.user", "*****@*****.**");
    props.put("mail.smtp.password", "475508th");
    props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
    props.setProperty("mail.smtp.socketFactory.fallback", "false");
    props.setProperty("mail.smtp.port", "465");
    props.setProperty("mail.smtp.socketFactory.port", "465");
    props.put("mail.smtp.auth", "true");
    props.put("mail.debug", "true");
    props.put("mail.store.protocol", "pop3");
    props.put("mail.transport.protocol", "smtp");

    Session session = Session.getDefaultInstance(props, new SmtpAuthenticator());

    try {
      MimeMessage message = new MimeMessage(session);
      message.setFrom(new InternetAddress(from));
      message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
      message.setSubject("Registration on acm.utmn.ru");
      message.setText(
          "Hello! Thank you for registration on acm.utmn.ru! Use next token to submit tasks: "
              + contestToken);
      Transport t = session.getTransport("smtp");
      t.send(message);
      System.out.println("Message was successfully sent.");
    } catch (MessagingException mex) {
      mex.printStackTrace();
    }
  }
예제 #3
0
  // Send the specified message.
  public void sendMessage(int type, Message message) throws Exception {
    // Display message dialog to get message values.
    MessageDialog dialog;
    dialog = new MessageDialog(this, null, type, message);
    if (!dialog.display()) {
      // Return if dialog was cancelled.
      return;
    }

    // Create a new message with values from dialog.
    Message newMessage = new MimeMessage(session);
    newMessage.setFrom(new InternetAddress(dialog.getFrom()));

    newMessage.setSubject(dialog.getSubject());
    newMessage.setSentDate(new Date());
    newMessage.setText(dialog.getContent());

    final Address[] recipientAddresses = InternetAddress.parse(dialog.getTo());
    newMessage.setRecipients(Message.RecipientType.TO, recipientAddresses);

    Transport transport = session.getTransport("smtps");
    transport.connect(getSmtpServer(), GMAIL_SMTP_PORT, getUsername(), getPassword());
    transport.sendMessage(newMessage, recipientAddresses);
    transport.close();
  }
예제 #4
0
  public static void sendEmail(
      InternetAddress from, InternetAddress to, String content, String requester)
      throws MessagingException, UnsupportedEncodingException {

    Properties props = new Properties();

    props.put("mail.transport.protocol", "smtps");
    props.put("mail.smtps.host", SMTP_HOST_NAME);
    props.put("mail.smtps.auth", "true");

    Session mailSession = Session.getDefaultInstance(props);
    mailSession.setDebug(false);
    Transport transport = mailSession.getTransport();

    MimeMessage message = new MimeMessage(mailSession);
    message.setSubject("MN Traffic Generation is used by " + requester);
    message.setContent(content, "text/plain");

    message.addRecipient(Message.RecipientType.TO, to);

    InternetAddress[] replyto = new InternetAddress[1];
    replyto[0] = from;

    message.setFrom(from);
    message.setReplyTo(replyto);
    message.setSender(from);

    transport.connect(SMTP_HOST_NAME, SMTP_HOST_PORT, SMTP_AUTH_USER, SMTP_AUTH_PWD);

    transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO));

    transport.close();
  }
  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();

    src = createBareRepository();
    dst = createBareRepository();

    // Fill dst with a some common history.
    //
    TestRepository<Repository> d = new TestRepository<Repository>(dst);
    a = d.blob("a");
    A = d.commit(d.tree(d.file("a", a)));
    B = d.commit().parent(A).create();
    d.update(R_MASTER, B);

    // Clone from dst into src
    //
    Transport t = Transport.open(src, uriOf(dst));
    try {
      t.fetch(PM, Collections.singleton(new RefSpec("+refs/*:refs/*")));
      assertEquals(B, src.resolve(R_MASTER));
    } finally {
      t.close();
    }

    // Now put private stuff into dst.
    //
    b = d.blob("b");
    P = d.commit(d.tree(d.file("b", b)), A);
    d.update(R_PRIVATE, P);
  }
 private void closeTransport() {
   if (currentTransport != null) {
     currentTransport.close();
     stats.aggregate(currentTransport.stats());
     currentTransport = null;
   }
 }
예제 #7
0
  public static void main(String[] args) throws MessagingException, IOException {
    Properties props = new Properties();
    try (InputStream in = Files.newInputStream(Paths.get("mail", "mail.properties"))) {
      props.load(in);
    }
    List<String> lines = Files.readAllLines(Paths.get(args[0]), Charset.forName("UTF-8"));

    String from = lines.get(0);
    String to = lines.get(1);
    String subject = lines.get(2);

    StringBuilder builder = new StringBuilder();
    for (int i = 3; i < lines.size(); i++) {
      builder.append(lines.get(i));
      builder.append("\n");
    }

    Console console = System.console();
    String password = new String(console.readPassword("Password: "));

    Session mailSession = Session.getDefaultInstance(props);
    // mailSession.setDebug(true);
    MimeMessage message = new MimeMessage(mailSession);
    message.setFrom(new InternetAddress(from));
    message.addRecipient(RecipientType.TO, new InternetAddress(to));
    message.setSubject(subject);
    message.setText(builder.toString());
    Transport tr = mailSession.getTransport();
    try {
      tr.connect(null, password);
      tr.sendMessage(message, message.getAllRecipients());
    } finally {
      tr.close();
    }
  }
 public void verify() {
   if (transport.getVehicle() == null) {
     throw new TestErrorException("Transport.getVehicle() was null.");
   }
   if (transport.getVehicle().getTransientValue() == null) {
     throw new TestErrorException("TransientValue should not be null.");
   }
 }
예제 #9
0
 public static Transport byName(String value) {
   for (Transport t : Transport.values()) {
     if (t.getValue().equals(value)) {
       return t;
     }
   }
   throw new IllegalArgumentException("Can't find " + value + " transport");
 }
 public static Transport fromString(String s) {
   for (Transport t : Transport.values()) {
     if (t.toString().equals(s)) {
       return t;
     }
   }
   return null;
 }
예제 #11
0
  ServiceController<?> installContainerConfigurationService(
      ServiceTarget target,
      String containerName,
      String defaultCache,
      boolean statistics,
      ModuleIdentifier moduleId,
      String stack,
      Transport transportConfig,
      String transportExecutor,
      String listenerExecutor,
      String evictionExecutor,
      String replicationQueueExecutor,
      ServiceVerificationHandler verificationHandler) {

    final ServiceName configServiceName =
        EmbeddedCacheManagerConfigurationService.getServiceName(containerName);
    final EmbeddedCacheManagerDependencies dependencies =
        new EmbeddedCacheManagerDependencies(transportConfig);
    final Service<EmbeddedCacheManagerConfiguration> service =
        new EmbeddedCacheManagerConfigurationService(
            containerName, defaultCache, statistics, moduleId, dependencies);
    final ServiceBuilder<EmbeddedCacheManagerConfiguration> configBuilder =
        target
            .addService(configServiceName, service)
            .addDependency(
                Services.JBOSS_SERVICE_MODULE_LOADER,
                ModuleLoader.class,
                dependencies.getModuleLoaderInjector())
            .addDependency(
                MBeanServerService.SERVICE_NAME,
                MBeanServer.class,
                dependencies.getMBeanServerInjector())
            .setInitialMode(ServiceController.Mode.ON_DEMAND);

    // add these dependencies only if we have a transport defined
    if (transportConfig != null) {
      if (transportExecutor != null) {
        addExecutorDependency(
            configBuilder, transportExecutor, transportConfig.getExecutorInjector());
      }
      configBuilder.addDependency(
          ChannelFactoryService.getServiceName(stack),
          ChannelFactory.class,
          transportConfig.getChannelFactoryInjector());
    }

    addExecutorDependency(
        configBuilder, listenerExecutor, dependencies.getListenerExecutorInjector());
    addScheduledExecutorDependency(
        configBuilder, evictionExecutor, dependencies.getEvictionExecutorInjector());
    addScheduledExecutorDependency(
        configBuilder,
        replicationQueueExecutor,
        dependencies.getReplicationQueueExecutorInjector());

    return configBuilder.install();
  }
예제 #12
0
  public void send() {

    Properties props = new Properties();

    props.setProperty("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", SMTP_HOST_NAME);
    Session mailSession = Session.getDefaultInstance(props);
    // mailSession.setDebug(true);
    Transport transport;
    try {
      transport = mailSession.getTransport();

      MimeMessage message = new MimeMessage(mailSession);
      message.setFrom(new InternetAddress(userName));
      message.setSubject(subject);

      message.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient));

      if (!cc.equals("")) {
        message.addRecipient(Message.RecipientType.CC, new InternetAddress(cc));
      }
      if (!bcc.equals("")) {
        message.addRecipient(Message.RecipientType.BCC, new InternetAddress(bcc));
      }

      // create the message part
      MimeBodyPart messageBodyPart = new MimeBodyPart();

      // fill message
      messageBodyPart.setText(content);

      Multipart multipart = new MimeMultipart();
      multipart.addBodyPart(messageBodyPart);
      if (fList != null) {
        Iterator<File> i = fList.iterator();
        // part two is attachment
        while (i.hasNext()) {
          File file = (File) i.next();
          messageBodyPart = new MimeBodyPart();
          DataSource source = new FileDataSource(file);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(file.getName());
          multipart.addBodyPart(messageBodyPart);
        }
      }
      // Put parts in message
      message.setContent(multipart);

      Transport.send(message);

      transport.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
예제 #13
0
 private Response readNetworkResponse()
 {
     transport.finishRequest();
     Response response1 = transport.readResponseHeaders().request(networkRequest).handshake(connection.getHandshake()).header(OkHeaders.SENT_MILLIS, Long.toString(sentRequestMillis)).header(OkHeaders.RECEIVED_MILLIS, Long.toString(System.currentTimeMillis())).build();
     Response response = response1;
     if (!forWebSocket)
     {
         response = response1.newBuilder().body(transport.openResponseBody(response1)).build();
     }
     Internal.instance.setProtocol(connection, response.protocol());
     return response;
 }
예제 #14
0
 @Override
 protected void doStart() throws ElasticsearchException {
   adapter.rxMetric.clear();
   adapter.txMetric.clear();
   transport.transportServiceAdapter(adapter);
   transport.start();
   if (transport.boundAddress() != null && logger.isInfoEnabled()) {
     logger.info("{}", transport.boundAddress());
   }
   boolean setStarted = started.compareAndSet(false, true);
   assert setStarted : "service was already started";
 }
  public void test() {
    transport = Transport.example6();
    UnitOfWork uow = getSession().acquireUnitOfWork();
    uow.registerObject(transport);
    uow.commit();

    transportId = transport.getId();

    DatabaseSession session = (DatabaseSession) getSession();
    ExpressionBuilder exp = new ExpressionBuilder();
    Expression expression = exp.get("id").equal(transportId);
    transport = (Transport) session.readObject(Transport.class, expression);
  }
예제 #16
0
 public void dataAckReceived(Transport t) {
   aa(this, isClosurePending() || isConnected(), "dataAckReceived by invalid state");
   aa(this, isSender(), "dataAckReceived by non sender");
   if (t.getSeqNum() > this.sendBase) {
     this.sendBase = t.getSeqNum();
     p(this, 3, "dataAckReceived: advancing sendBase to " + sendBase);
     sendFromBuffer();
   } else
     p(
         this,
         3,
         "dataAckReceived: ignored sendBase >= ackNum: " + sendBase + " > " + t.getSeqNum());
 }
예제 #17
0
  public XMLizable send(
      String soapAction,
      QName requestElement,
      XMLizable request,
      QName responseElement,
      Class responseType)
      throws ConnectionException {

    long startTime = System.currentTimeMillis();

    try {
      boolean firstTime = true;
      while (true) {
        try {
          Transport transport = newTransport(config);
          OutputStream out = transport.connect(url, soapAction);
          sendRequest(out, request, requestElement);
          InputStream in = transport.getContent();
          XMLizable result;
          result = receive(transport, responseElement, responseType, in);
          return result;
        } catch (SessionTimedOutException se) {
          if (config.getSessionRenewer() == null || !firstTime) {
            throw (ConnectionException) se.getCause();
          } else {
            SessionRenewer.SessionRenewalHeader sessionHeader =
                config.getSessionRenewer().renewSession(config);
            if (sessionHeader != null) {
              addHeader(sessionHeader.name, sessionHeader.headerElement);
            }
          }
        }
        firstTime = false;
      }
    } catch (SocketTimeoutException e) {
      long timeTaken = System.currentTimeMillis() - startTime;
      throw new ConnectionException(
          "Request to "
              + url
              + " timed out. TimeTaken="
              + timeTaken
              + " ConnectionTimeout="
              + config.getConnectionTimeout()
              + " ReadTimeout="
              + config.getReadTimeout(),
          e);

    } catch (IOException e) {
      throw new ConnectionException("Failed to send request to " + url, e);
    }
  }
  public static void sendMail(String to, String subject, String msg) throws MessagingException {
    final String from = "*****@*****.**";
    final String password = "******";

    //        JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    //        mailSender.setHost("smtp.gmail.com");
    //        mailSender.setPort(587);
    //        mailSender.setUsername("farmayaa");
    //        mailSender.setPassword(password);
    //
    //        SimpleMailMessage message = new SimpleMailMessage();
    //
    //        message.setFrom(from);
    //        message.setTo(to);
    //        message.setSubject(subject);
    //        message.setText(msg);
    //        mailSender.send(message);

    Properties props = new Properties();
    props.setProperty("mail.transport.protocol", "smtp");
    props.setProperty("mail.host", "smtp.gmail.com");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.port", "465");
    props.put("mail.debug", "true");
    props.put("mail.smtp.socketFactory.port", "465");
    props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    props.put("mail.smtp.socketFactory.fallback", "false");
    Session session =
        Session.getDefaultInstance(
            props,
            new javax.mail.Authenticator() {
              protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(from, password);
              }
            });

    // session.setDebug(true);
    Transport transport = session.getTransport();
    InternetAddress addressFrom = new InternetAddress(from);

    MimeMessage message = new MimeMessage(session);
    message.setSender(addressFrom);
    message.setSubject(subject);
    message.setContent(msg, "text/plain");
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));

    transport.connect();
    Transport.send(message);
    transport.close();
  }
예제 #19
0
  public synchronized void sendMail(Mail m) throws MessagingException {

    MimeMessage message = new MimeMessage(session);
    DataHandler handler =
        new DataHandler(new ByteArrayDataSource(m.getBody().getBytes(), "text/plain"));
    message.setSender(new InternetAddress(m.getSender()));
    message.setSubject(m.getSubject());
    message.setDataHandler(handler);
    message.setRecipient(Message.RecipientType.TO, new InternetAddress(m.getRecipient()));
    Transport tr = session.getTransport("smtp");
    tr.connect(user, password);
    tr.send(message);
    tr.close();
  }
  @Override
  public void onConnectionBound(Event event) {
    Transport transport = event.getTransport();
    SslDomain domain = Proton.sslDomain();
    domain.init(Mode.SERVER);

    domain.setPeerAuthentication(SslDomain.VerifyMode.ANONYMOUS_PEER);
    transport.ssl(domain);

    Sasl sasl = transport.sasl();
    sasl.allowSkip(true);
    sasl.setMechanisms("PLAIN");
    // sasl.done(SaslOutcome.PN_SASL_OK);*/
  }
예제 #21
0
 public void setInfected(boolean infected) {
   if (infected) {
     if (status == 0) {
       Linkable l = (Linkable) node.getProtocol(p.lid);
       Transport t = (Transport) node.getProtocol(p.tid);
       for (int i = 0; i < l.degree(); i++) {
         t.send(node, l.getNeighbor(i), INFECTION, p.pid);
       }
       status = 1;
     }
   } else {
     status = 0;
   }
 }
  @Override
  public void run() {
    Request request = null;
    try {
      request = transport.prepare();
      jsonOut = jsonFactory.createGenerator(request.getBodyWriter());
      jsonOut.writeStartObject();
      jsonOut.writeFieldName("series");
      jsonOut.writeStartArray();
    } catch (IOException ioe) {
      LOG.error("Could not prepare request", ioe);
      return;
    }

    final long epoch = clock.time() / 1000;
    if (this.printVmMetrics) {
      pushVmMetrics(epoch);
    }
    pushRegularMetrics(epoch);

    try {
      jsonOut.writeEndArray();
      jsonOut.writeEndObject();
      jsonOut.flush();
      request.send();
    } catch (Exception e) {
      LOG.error("Error sending metrics", e);
    }
  }
예제 #23
0
 public static void email(
     CallingContext context, String templateName, Map<String, ? extends Object> templateValues) {
   final SMTPConfig config = getSMTPConfig();
   Session session = getSession(config);
   EmailTemplate template = getEmailTemplate(context, templateName);
   try {
     // Instantiate a new MimeMessage and fill it with the required information.
     Message msg = new MimeMessage(session);
     msg.setFrom(new InternetAddress(config.getFrom()));
     String to = renderTemplate(template.getEmailTo(), templateValues);
     if (StringUtils.isBlank(to)) {
       throw RaptureExceptionFactory.create("No emailTo field");
     }
     InternetAddress[] address = {new InternetAddress(to)};
     msg.setRecipients(Message.RecipientType.TO, address);
     msg.setSubject(renderTemplate(template.getSubject(), templateValues));
     msg.setSentDate(new Date());
     msg.setContent(
         renderTemplate(template.getMsgBody(), templateValues), "text/html; charset=utf-8");
     // Hand the message to the default transport service for delivery.
     Transport.send(msg);
   } catch (MessagingException e) {
     log.error("Failed to send email", e);
   }
 }
예제 #24
0
 public synchronized void stop() {
   if (transport == null) {
     return;
   }
   transport.stop();
   transport = null;
 }
예제 #25
0
  public static void sendMail(String recipient, String subject, String body)
      throws MessagingException {

    Session session =
        Session.getInstance(
            properties,
            new Authenticator() {
              protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(username, password);
              }
            });

    MimeMessage message = new MimeMessage(session);

    message.setFrom(new InternetAddress(username));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient));

    message.setSubject(subject);

    message.setContent(body, "text/html; charset=utf-8");

    logger.debug("send email to " + recipient);

    Transport.send(message);
  }
예제 #26
0
  /** Sends Emails to Customers who have not submitted their Bears */
  public static void BearEmailSendMessage(String msgsubject, String msgText, String msgTo) {
    try {
      BearFrom = props.getProperty("BEARFROM");
      // To = props.getProperty("TO");
      SMTPHost = props.getProperty("SMTPHOST");
      Properties mailprops = new Properties();
      mailprops.put("mail.smtp.host", SMTPHost);

      // create some properties and get the default Session
      Session session = Session.getDefaultInstance(mailprops, null);

      // create a message
      Message msg = new MimeMessage(session);

      // set the from
      InternetAddress from = new InternetAddress(BearFrom);
      msg.setFrom(from);
      InternetAddress[] address = InternetAddress.parse(msgTo);
      msg.setRecipients(Message.RecipientType.TO, address);
      msg.setSubject(msgsubject);
      msg.setContent(msgText, "text/plain");
      Transport.send(msg);
    } // end try
    catch (MessagingException mex) {
      USFEnv.getLog().writeCrit("Message not sent", null, null);
    } catch (Exception ex) {
      USFEnv.getLog().writeCrit("Message not sent", null, null);
    }
  } // end BearEmailSendMessage
  public void postMail(String recipients[], String subject, String message, String from)
      throws MessagingException {
    boolean debug = false;

    // Set the host smtp address
    Properties props = new Properties();
    props.put("mail.smtp.host", SMTP_HOST_NAME);
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.timeout", 60000);

    Authenticator auth = new SMTPAuthenticator();
    Session session = Session.getDefaultInstance(props, auth);

    session.setDebug(debug);

    // create a message
    Message msg = new MimeMessage(session);

    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);

    InternetAddress[] addressTo = new InternetAddress[recipients.length];
    for (int i = 0; i < recipients.length; i++) {
      addressTo[i] = new InternetAddress(recipients[i]);
    }
    msg.setRecipients(Message.RecipientType.TO, addressTo);

    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/html");
    Transport.send(msg);
  }
예제 #28
0
  public void send(String subject, String text, String fromEmail, String toEmail) {
    Session session =
        Session.getDefaultInstance(
            props,
            new Authenticator() {
              protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(username, password);
              }
            });

    try {
      Message message = new MimeMessage(session);
      // от кого
      message.setFrom(new InternetAddress(username));
      // кому
      message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toEmail));
      // тема сообщения
      message.setSubject(subject);
      // текст
      message.setText(text);

      // отправляем сообщение
      Transport.send(message);
    } catch (MessagingException e) {
      throw new RuntimeException(e);
    }
  }
예제 #29
0
  public void mail(String toAddress, String subject, String body) {
    Properties props = new Properties();
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.ssl.enable", true);
    Authenticator authenticator = null;
    if (login) {
      props.put("mail.smtp.auth", true);
      authenticator =
          new Authenticator() {
            private PasswordAuthentication pa = new PasswordAuthentication(username, password);

            @Override
            public PasswordAuthentication getPasswordAuthentication() {
              return pa;
            }
          };
    }

    Session s = Session.getInstance(props, authenticator);
    s.setDebug(debug);
    MimeMessage email = new MimeMessage(s);
    try {
      email.setFrom(new InternetAddress(from));
      email.setRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
      email.setSubject(subject);
      email.setSentDate(new Date());
      email.setText(body);
      Transport.send(email);
    } catch (MessagingException ex) {
      ex.printStackTrace();
    }
  }
예제 #30
0
  public void send() {
    // Your SMTP server address here.
    String smtpHost = "myserver.jeffcorp.com";
    // The sender's email address
    String from = "*****@*****.**";
    // The recepients email address
    String to = "*****@*****.**";

    Properties props = new Properties();
    // The protocol to use is SMTP
    props.put("mail.smtp.host", smtpHost);

    Session session = Session.getDefaultInstance(props, null);

    try {
      InternetAddress[] address = {new InternetAddress(to)};
      MimeMessage message;

      message = new MimeMessage(session);
      message.setFrom(new InternetAddress(from));

      message.setRecipients(Message.RecipientType.TO, to);
      message.setSubject("Hello from Jeff");
      message.setSentDate(sendDate);
      message.setText("Hello Jeff, \nHow are things going?");

      Transport.send(message);

      System.out.println("email has been sent.");
    } catch (Exception e) {
      System.out.println(e);
    }
  }