Package javax.mail.internet

Examples of javax.mail.internet.InternetAddress


  }

  // ---------------------------------------------------------------------------

  public InternetAddress getFrom () throws MessagingException {
    InternetAddress oAddr = null;
    Address[] aAddrs = oMsg.getFrom();   
   
    if (aAddrs!=null)
      if (aAddrs.length>0)
        oAddr = (InternetAddress) aAddrs[0];
View Full Code Here


        oXBuffer.append("<received></received>");
      else
        oXBuffer.append("<received>"+DateFrmt.format(oMsg.getReceivedDate())+"</received>");     
      if (!oMsg.isSet(Flags.Flag.DELETED)) {
        try {
          InternetAddress oAdr = getFrom();
          if (oAdr!=null) {
            sHeader = oAdr.getPersonal();
            if (null==sHeader) sHeader = oAdr.getAddress(); else sHeader = MimeUtility.decodeText(sHeader);
            if (null==sHeader) sHeader = oMsg.getHeader("Return-Path"," ");
            if (null==sHeader) sHeader = "";           
            oXBuffer.append("<from><![CDATA["+Gadgets.XHTMLEncode(sHeader)+"]]></from>");
        oAdr = null;
          }
View Full Code Here

    */
   public void verifyInternetAddress(String address) throws XmlBlasterException {
      String[] arr = StringPairTokenizer.parseLine(address);
      for (int i = 0; i < arr.length; i++) {
         try {
            new InternetAddress(arr[i]);
         } catch (Throwable e) {
            throw new XmlBlasterException(this.engineGlob,
                  ErrorCode.RESOURCE_CONFIGURATION_ADDRESS, ME,
                  "Illegal email address '" + address + "': " + e.toString());
         }
View Full Code Here

    Multipart multipart = new MimeMultipart();
    multipart.addBodyPart(bp1);
    multipart.addBodyPart(bp2);

    baseMsg.setFrom(new InternetAddress("Ted <ted@home.com>"));
    baseMsg.setRecipient(Message.RecipientType.TO, new InternetAddress(
        "success@subethamail.org"));
    baseMsg.setSubject("Test Big attached file message");
    baseMsg.setContent(multipart);
    baseMsg.saveChanges();

    log.debug("Send started");
    Transport t = new SMTPTransport(session, new URLName("smtp://localhost:"+SMTP_PORT));
    long started = System.currentTimeMillis();
    t.connect();
    t.sendMessage(baseMsg, new Address[] {new InternetAddress(
        "success@subethamail.org")});
    t.close();
    started = System.currentTimeMillis() - started;
    log.info("Elapsed ms = "+started);
View Full Code Here

      String Subject = "Test";
      String body = "Test Body";

      Session session = Session.getInstance(this.getMailProperties(SMTP_PORT), null);
      Message msg = new MimeMessage(session);
      msg.setFrom(new InternetAddress(From));
      msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(To, false));
      msg.setSubject(Subject);

      msg.setText(body);
      msg.setHeader("X-Mailer", "musala");
View Full Code Here

  /** */
  private MimeMessage createMessage(Session session, String from, String to, String subject, String body)
    throws MessagingException, IOException
  {
    MimeMessage msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    msg.setText(body);
    msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
    return msg;
  }
View Full Code Here

  /** */
  private MimeMessage createMessageWithCharset(Session session, String from, String to, String subject, String body, String charset)
    throws MessagingException
  {
    MimeMessage msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    msg.setSubject(subject);
    msg.setSentDate(new Date());
    if (charset != null)
    {
      msg.setText(body, charset);
      msg.setHeader("Content-Transfer-Encoding", "7bit");
    }
    else
      msg.setText(body);

    msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
    return msg;
  }
View Full Code Here

  /** */
  public void testReceivedHeader() throws Exception
  {
    MimeMessage message = new MimeMessage(this.session);
    message.addRecipient(Message.RecipientType.TO, new InternetAddress("anyone@anywhere.com"));
    message.setFrom(new InternetAddress("someone@somewhereelse.com"));
    message.setSubject("barf");
    message.setText("body");

    Transport.send(message);

View Full Code Here

  /** */
  public void testMultipleRecipients() throws Exception
  {
    MimeMessage message = new MimeMessage(this.session);
    message.addRecipient(Message.RecipientType.TO, new InternetAddress("anyone@anywhere.com"));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress("anyone2@anywhere.com"));
    message.setFrom(new InternetAddress("someone@somewhereelse.com"));
    message.setSubject("barf");
    message.setText("body");

    Transport.send(message);

View Full Code Here

  /** */
  public void testLargeMessage() throws Exception
  {
    MimeMessage message = new MimeMessage(this.session);
    message.addRecipient(Message.RecipientType.TO, new InternetAddress("anyone@anywhere.com"));
    message.addRecipient(Message.RecipientType.TO, new InternetAddress("anyone2@anywhere.com"));
    message.setFrom(new InternetAddress("someone@somewhereelse.com"));
    message.setSubject("barf");
    message.setText("bodyalksdjflkasldfkasjldfkjalskdfjlaskjdflaksdjflkjasdlfkjl");

    Transport.send(message);

View Full Code Here

TOP

Related Classes of javax.mail.internet.InternetAddress

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.