Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MX Eintrag

Empfohlene Antworten

Veröffentlicht

Hallo Board,

hat jemand ne Ahnung wie ich an den MX-DNS-Eintrag ran komme per java?

Such mich hier gerade wund ;-)

Gibts da was auf bordmitteln oder müssens externe libs machen? wenn ja, wo gibts die? *g

danke im Voraus

mfg jghj

mmhhh...dann muss ich wohl wirklich direkt mim dns sprechen und das Protokoll zunem kleinen Teil implementieren oder?

Gibts da evtl schon ne java klasse? oder was nettes zum lesen außer die _bösartigen_ rfcs ;-) sonst werd ich mich wohl auf diese stürzen =)

mfg jghj

Hab da doch noch ne Möglichkeit gefunden und ne Klasse geschrieben.

Ich nehme nur den ersten Empfangenen Record und gebe ihn zurück, das kann man natürlich auch noch weiter ausbauen und alle innem array oder ner liste zurückgeben....naja hier der source:


import java.util.regex.Pattern;


import javax.naming.NamingException;

import javax.naming.directory.Attribute;

import javax.naming.directory.InitialDirContext;


final public class MXRecord {

	final public static String sValidDns = "^(?:[a-zA-Z0-9\\-_]+\\.){1,}[a-zA-Z]{2,5}$";


	public static String getMXRecord( String sDomainName )

	{

		if( sDomainName == null )

		{

			return null;

		}

		if( !Pattern.matches( sValidDns, sDomainName ) )

		{

			/*

			 * invalid domain name

			 */

			return null;

		}


		try {

			InitialDirContext iDC = new InitialDirContext();

			Attribute attr = iDC.getAttributes( "dns:/"+ sDomainName, new String[] { "MX" } ).get( "MX" );


			if( attr == null || attr.size() == 0 )

			{

				/*

				 * if no record exists, it's the domain self

				 */


				return sDomainName;

			}


			String[] parts = attr.get( 0 ).toString().split( "[ \t]+" );

			if( parts.length < 2 )

			{

				return null;

			}


			return parts[ 1 ];

		} catch (NamingException e) {

			return null;

		}

	}

}


viel spaß damit ;-)

mfg jghj

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.