Package org.jasen.net

Examples of org.jasen.net.MXRecord


                    // The MX records returned will be in the format:
                    // <preference> domain.
                    // eg.
                    // 10 maila.microsoft.com.
                    String record = null;
                    MXRecord mxRecord = null;
                    String[] parsed = null;

                    records = new MXRecord[at.size ()];

                    for (int i = 0; i < at.size (); i++)
                    {
                        record = at.get (i).toString ();
                        parsed = record.split (" ");

                        if (parsed.length > 1)
                        {
                            mxRecord = new MXRecord ();
                            mxRecord.setPreference (Integer.parseInt (parsed[0]));

                            if (parsed[1].endsWith ("."))
                            {
                                parsed[1] = parsed[1].substring (0, parsed[1].length () - 1);
                            }

                            mxRecord.setAddress (InetAddress.getByName (parsed[1]));
                            records[i] = mxRecord;
                        }
                        else
                        {
                            throw new DNSException ("Error parsing MX record");
View Full Code Here


          // Get the MX records for the receiver domain
          MXRecord[] receiverMXRecords = DNSUtils.getMXRecords(dresolver, receiverRootDomain);

          // The sender address is valid if one IP matches
          MXRecord senderMX = null;
          MXRecord receiverMX = null;

          if (senderMXRecords != null && senderMXRecords.length > 0) {
            if (receiverMXRecords != null && receiverMXRecords.length > 0) {
              for (int i = 0; i < senderMXRecords.length; i++) {
                senderMX = senderMXRecords[i];

                for (int j = 0; j < receiverMXRecords.length; j++) {
                  receiverMX = receiverMXRecords[j];

                  if (senderMX.getAddress().getHostAddress().equalsIgnoreCase(receiverMX.getAddress().getHostAddress())) {
                    return true;
                  }
                }
              }
            }
View Full Code Here

TOP

Related Classes of org.jasen.net.MXRecord

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.