Skip to content
View in the app

A better way to browse. Learn more.

Froxlor Forum

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.

Import von vielen Emailadressen

Featured Replies

Hallo, 

ich steh vor der Herausforderung viele Emailadressen zu importieren bzw. neu anzulegen.

Prinzipiell dachte ich, das über die API zu machen, vorzugsweise auf der CLI.

Ist das eine gute Idee?

Gibt es dazu eventuell ein Beispiel?

beste Grüße 

da es keinen email-adressen importer via UI gibt bietet sich die API an ja :)

Ein beispiel wäre:

<?php

// include FroxlorAPI helper class
require __DIR__ . '/FroxlorAPI.php';

// create object of FroxlorAPI with URL, apikey and apisecret
$fapi = new FroxlorAPI('http://127.0.0.1/api.php', 'your-api-key', 'your-api-secret');

// source data (loginname only required if called as admin/reseller)
$email_addresses = [
  ['email_part' => 'one', 'domain' => 'domain.tld', 'loginname' => 'web1'],
  ['email_part' => 'two', 'domain' => 'domain.tld', 'loginname' => 'web1'],
  ['email_part' => 'three', 'domain' => 'domain.tld', 'loginname' => 'web2'],
  ['email_part' => 'four', 'domain' => 'domain.tld', 'loginname' => 'web2'],
  // ...
];

// loop through data
foreach ($email_addresses as $email_addr)
{
  // send request
  $fapi->request('Emails.add', $email_addr);
  
  // check for error
  if ($fapi->getLastStatusCode() != 200) {
	echo "HTTP-STATUS: " . $fapi->getLastStatusCode() . PHP_EOL;
    echo "Description: "  . $response['message'] . PHP_EOL;
  }
}

 

See also API documentation: https://docs.froxlor.org/latest/api-guide/commands/emails.html

  • Author

Genau das hab ich gesucht! Cool danke !!!

  • Author

Kurze Frage: also Adresse anlegen, wird auch das Konto direkt angelegt?

nein, Konto anlegen ist ein zweiter Schritt - man kann ja auch Adressen haben, ohne das diese ein Konto sind.

Müsstest du einen zweiten API call machen:

<?php

// include FroxlorAPI helper class
require __DIR__ . '/FroxlorAPI.php';

// create object of FroxlorAPI with URL, apikey and apisecret
$fapi = new FroxlorAPI('http://127.0.0.1/api.php', 'your-api-key', 'your-api-secret');

// source data (loginname only required if called as admin/reseller)
$email_addresses = [
  ['email_part' => 'one', 'domain' => 'domain.tld', 'loginname' => 'web1', 'email_password' => 's3cret'],
  ['email_part' => 'two', 'domain' => 'domain.tld', 'loginname' => 'web1'],
  ['email_part' => 'three', 'domain' => 'domain.tld', 'loginname' => 'web2'],
  ['email_part' => 'four', 'domain' => 'domain.tld', 'loginname' => 'web2'],
  // ...
];

// loop through data
foreach ($email_addresses as $email_addr)
{
  // check for account-password
  $accnt_pwd = $email_addr['email_password'] ?? null;
  unset($email_addr['email_password']);
  
  // send request
  $fapi->request('Emails.add', $email_addr);
  
  // check for error
  if ($fapi->getLastStatusCode() != 200) {
	echo "HTTP-STATUS: " . $fapi->getLastStatusCode() . PHP_EOL;
    echo "Description: "  . $response['message'] . PHP_EOL;
    continue;
  }
  
  // create account if password is set
  if (!empty($accnt_pwd)) {
    // send request
    $fapi->request('EmailAccounts.add', [
      'emailaddr' => $email_addr['email_part'] . '@' . $email_addr['domain'],
      'loginname' => $email_addr['loginname'],
      'email_password' => $accnt_pwd
    ]);
    
    // check for error
    if ($fapi->getLastStatusCode() != 200) {
	  echo "HTTP-STATUS: " . $fapi->getLastStatusCode() . PHP_EOL;
      echo "Description: "  . $response['message'] . PHP_EOL;
    }
  }
  
}

 

  • Author

Super!!!!

Create an account or sign in to comment

Account

Navigation

Search

Search

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.