Open Source Dokumentenmanagement
Dokumentation

Durchsuchbare Dokumentation aufrufen | Zurück zur Dokumentationsübersicht

Navigation: Dokumentationen agorum core > Konfigurationen zu E-Mails


IMAP-Verbindung per Skript testen

Mit dem folgenden Skript testen Sie die IMAP-Verbindung:

/* global Packages, sessionController */

let objects = require('common/objects'),
    beans = require('common/beans');

// create the properties for the Session
let props = new Packages.java.util.Properties();

// don't fallback to normal IMAP connections on failure.
props.setProperty("mail.imap.socketFactory.fallback", "false");

props.setProperty("mail.imap.connectiontimeout", '300000');
props.setProperty("mail.imaps.connectiontimeout", '300000');
props.setProperty("mail.pop3.connectiontimeout", '300000');
props.setProperty("mail.pop3s.connectiontimeout", '300000');

props.setProperty("mail.imap.timeout", '300000');
props.setProperty("mail.imaps.timeout", '300000');
props.setProperty("mail.pop3.timeout", '300000');
props.setProperty("mail.pop3s.timeout", '300000');

// create the Session
let session = Packages.javax.mail.Session.getInstance(props);

// and create the store..
let store = session.getStore('imaps'); // IMAP(S) or POP3(S)

let port = 993; // IMAPS

// and connect.
store.connect('host', port, 'user', 'password');
'yeah, es funktioniert: ' + store.isConnected();