Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
This guide explains how to maintain control over your MP3/AAC or HLS Streaming Radio streams by activating unique key (token) protection to decide, for example, whether a listener can listen to your radio or not.
Introduction
- The principle is simple: with each connection, you will make a request to the Infomaniak API, which will return a unique token with a limited and customizable lifespan. This token will authorize anyone who possesses it to consume the stream during this period.
- You can protect an MP3/AAC or HLS stream independently of each other (the same applies to geolocation).
- Enabling the restriction involves changing the stream configuration, which may take a few minutes to be replicated across the servers.
Protect an audio stream with a unique key
To do this, simply go to the restriction settings and activate token protection on the stream you wish to secure:
- Click here to access the management of your product on the Manager Infomaniak (need help?).
- Click directly on the name assigned to the product in question.
- Click on the name of the audio stream in question.
- Click on Restrictions in the left sidebar.
- Select HLS if necessary.
- Click on the action menu â‹® located to the right of the relevant item.
- Click on Token Restriction:
Enable the protection next.
Warning, when you activate this option, access to the stream will be instantly blocked for new connections. Adapt your Players to take into account the restriction, as illustrated in the example below:
Create a Radio API Token
To access the Radio API, you must first authenticate using an application token. This step only needs to be done once. To create this application token, refer to this other guide.
The scope is radio and with unlimited lifetime to avoid having to regenerate a code on a regular basis. Once the token is generated, copy it to paste it into the example below.
PHP usage example
For MP3/AAC or HLS, the code can be quite similar, only the URL called in POST changes in its form.
Paste the generated token below instead of the one indicated:
if (!defined('API_TOKEN')) {
define('API_TOKEN', 'AYF5lSh3c7Xy5974Fs12RTkTThujT-L9R4Xk2ZfGyP6sV7QqJ1oC3jD8nFtKzIxUeMw5oNzR6');
}
/**
* Fonction générique pour executer des requêtes cURL
*
* @param string $method Méthode HTTP (GET, POST, PUT, etc...)
* @param string $url Url de l'api a requĂŞter
* @param array $headers Liste des en-têtes HTTP (l'autorisation doit être passée ici avec un ['Authorization: Bearer ']
* @param array $payload Un tableau contenant les données pour créer un token
* @return mixed
*/
function request(string $method, string $url, array $headers = [], array $payload = []): mixed{
// prepare options array
$opts = [
CURLOPT_HTTPHEADER => $headers,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url,
CURLOPT_CUSTOMREQUEST => strtoupper($method),
];
// add payload if relevant
if ($payload && $method !== 'GET') {
$opts[CURLOPT_POSTFIELDS] = json_encode($payload);
}
$ch = curl_init();
curl_setopt_array($ch, $opts);
$result = curl_exec($ch);
if(curl_errno($ch)){
throw new Exception(curl_error($ch));
}
$data = json_decode($result, true);
if ($data['result'] === 'error') {
throw new Exception($data['error']['description'] ?? 'an error occured');
}
return $data['data'];
}
We are going to create the token. The URL for creating the token breaks down as follows:
- For an MP3 / AAC stream
POST https://api.infomaniak.com/1/radios/acl/streams/mountpoint.mp3/token
Example to protect https://newradiotest.ice.infomaniak.ch/newradiotest-128.aac
the route will be: https://api.infomaniak.com/1/radios/acl/streams/newradiotest-128.aac/token
- For an HLS stream
POST https://api.infomaniak.com/1/radios/acl/hls_streams/<stream>/token
Example to protect https://myradiostream.radiohls.infomaniak.com/myradiostream/manifest.m3u8
the route will be: https://api.infomaniak.com/1/radios/acl/hls_streams/myradiostream/token
Example for MP3/AAC, make sure to adjust:
$token = request(
'POST',
'https://api.infomaniak.com/1/radios/acl/streams/newradiotest-128.aac/token',
// en-tĂŞte d'authorization
[
'Authorization: Bearer ' . API_TOKEN,
'Content-Type: application/json',
],
/**
* payload pour créer le token, vous pouvez passer les valeurs suivantes
* window | 300 | optionnel | durée de validité du token (default: 5 minutes)
*/
[
'window' => 3600, // 1h validity
]
);
It is important to note that if this code is generated at the time of page loading, the listener will have "window" seconds to start playing the stream. Beyond this delay, the token will expire, and the stream will no longer be able to be launched unless the page is reloaded. Depending on your needs and use case, it will be necessary to adjust this delay in the best possible way.
You will also need to replace the playback URL of your stream below with the one indicated, while keeping the $token
parameter at the end. Finally, display the Player (here a simple html5 tag, but you can of course add any overlay afterwards, the token being passed in the $_GET
parameters of the url).
$streamUrl = "https://newradiotest.ice.infomaniak.ch/newradiotest-128.aac?$token";
echo "<audio controls=""><source src="$streamUrl"></audio>";
This guide explains how to optimize the site you manage on a Web Hosting to make it faster and allow all visitors to browse it from the Internet without difficulty, regardless of their connection speed.
⚠️ For additional help contact a partner or launch a free tender — also discover the role of the host.
The role of the hoster
The loading speed of a website depends on many factors (server performance, host's network infrastructure, visitor's Internet connection, website optimization, etc.).
As a hosting provider, Infomaniak strives to offer the best in hosting and continually evolves its products and infrastructure:
- All hosting solutions run on the latest generation SSD drives.
- The infrastructure benefits from more than 70 Gbit/s of interconnection and redundancy with Cogent, Level3, etc.
- To handle traffic spikes without issue, the servers run on Intel Xeon 64-bit processors, which are regularly replaced, and the shared/mutualized servers use only 40% of their CPU power on average.
Moreover, when you submit a support request regarding slowness, Infomaniak analyzes whether…
- … your hosting server is functioning normally and has not encountered any issues in the last 48 hours.
- … the network infrastructure has not experienced any disruptions in the last 48 hours.
The role of the site owner and the webmaster
Infomaniak does not intervene in the content of the servers or the development of websites. The creation or maintenance of a site is a different profession, although it is related to its activities since the tools and services that a webmaster uses to create websites are offered.
Analyzing the cause of slowdowns
Here is what you should do if you notice slowness with your site:
- Follow the Google PageSpeed Insights recommendations to optimize your website... The points highlighted concern the design of the website and not the server configuration; refer to this other guide if the test result suggests enabling resource compression on your site.
- In case of slowness from abroad, consider activating DNS Fast Anycast.
- Install and configure a cache system on your site to avoid redundant access to databases and speed up the display of your site.
- Consider a CDN.
- Test the response speed of the server (TTFB).
- Scan your hosting for viruses.
- Purge the databases regularly and delete unnecessary entries.
- Use the latest PHP version compatible with your site/CMS/Web application.
- Avoid using images, counters, CGI, or media hosted by external providers, as if they are unreachable, your site will seem slow.
- Disable any unnecessary WordPress extensions that consume a lot of resources in your CMS.
- Keep your CMS/Web applications up to date regularly.
- Implement a crawl delay for indexing bots, as some have a very "aggressive" operation; it is possible to limit their impact by implementing a Crawl-delay.
- Check the possible error-logs which group all the errors generated by your site; by correcting these errors, your site will be more performant.
- Check the slowlogs: they group the queries that take more than 5 seconds to execute; it is important to correct the queries listed in this file (SQL optimization examples).
- Add a server cache system like Memcached (Cloud server only).
- Increase the max_children value (Cloud server only).
If a problem persists...
As a site owner, if you are a webmaster or have hired a webmaster who also cannot find the cause of the slowdowns, contact Infomaniak support in writing only after obtaining the following information:
- Hosted site name.
- Dates and times when the slowdowns were encountered.
- Name of the potentially affected database / same for FTP account.
- Your public IP address at the time of the tests (visible for example on https://www.infomaniak.com/ip).
- Type of slowness observed (site display, FTP transfers...).
- Issues (such as slowness) accessing the Infomaniak site intermittently?
- Result of a traceroute to
84.16.66.66
and copy-paste the complete results (screenshot if necessary). - Result of a speedtest by choosing Infomaniak as the destination (speedtest.net — click on Change Server to select Infomaniak).
If your needs skyrocket…
If shared hosting no longer suits your site, you should consider moving to a Cloud Server. Your site can be easily moved to this type of server where it will be alone and on which you can install a cache engine, for example.
This guide explains how to restore backups of previous versions of your files and other web data from your Infomaniak hosting, and how to implement an effective backup policy if the backups automatically and freely provided no longer meet your availability or security needs.
Web Hosting (Starter, Shared, Cloud Server)
Check out these guides to restore automatic backups:
- of an entire hosting (FTP + MySQL),
- of specific files on the hosting
- of specific databases,
- of a Web Application (Wordpress & Apps),
- the SSH crons of Serveur Cloud.
Check out these guides to backup and restore:
- a hosting with Swiss Backup and Acronis (simple),
- a hosting with Swiss Backup and Restic (advanced),
- WordPress with Swiss Backup,
- WordPress with an extension.
Also, refer to https://faq.infomaniak.com/snapshot.
Hostings v1 (old 60 Go offer)
- View and/or download the automatic backup (versioning) of your data on your FTP space under
/backups
and/backup_mysql
at the root of the domain (above/web
). - Restore this data.
- Restore messages from automatic Infomaniak backups.
- Restore contacts or calendar events.
- Save the current content of an email account:
- by downloading the current content locally,
- by duplicating all current content to a backup mailbox,
- by copying future emails as they arrive to a backup box.
Domains / DNS Zones
- Restore deleted DNS records from automatic Infomaniak backups.
- Restore an expired domain in redemption period.
This guide allows you to quickly use the essential functions of the Streaming Radio (or broadcast audio, live audio streaming... different terms used to refer to the same technology: sending content "live" or with a slight delay allowing it to be played as it is broadcast).
Where to start?
Stream configuration
- Configure the broadcasting of a Streaming Radio stream
- Add an audio stream relay
- Add a backup audio stream
- Delete a stream
Create a player to offer the stream to your users
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the relevant product.
- Click on My players in the left sidebar.
- Click on the blue button to add a player.
You can then choose between automatic configuration or, if you have your own player or application, use the information/URL provided for browser, external player/app/Android, or iOS…
To go further…
- Secure an MP3/AAC or HLS stream with a unique key
- Secure an audio stream by GeoIP restriction
- View listening statistics
- Export the Streaming Radio logs via FTP
- Export the logs to ACPM (France)
- Export the logs to Mediapulse (Switzerland)
- Solve a broadcasting issue
If needed, contact Infomaniak support.
This guide details how to get started with Swiss Backup, the backup solution in an independent Swiss cloud.
2 Swiss Backup variants
Infomaniak offers two backup modes depending on what you want to back up:
1. CLOUD Backups
Allows you to back up and sync files via the protocols:
- Swift (recommended)
- FTP / SFTP
- S3
- Synology NAS system
with the application of your choice
Cloud Backup Getting Started Guide
2. ACRONIS Backups
Ideal solution for backing up:
- workstations Windows / macOS
- mobiles iOS / Android (iPhone / Samsung, etc.)
- Windows/Linux servers
- websites
- virtual machines VMware, Hyper-V, Virtuozzo...
- Microsoft 365 / Google Workspace spaces...
using the software Acronis Cyber Protect Cloud which will perform automatic and customized backups
Click here to share a review or suggestion about an Infomaniak product.
This guide concerns UTM tags, or Urchin Tracking Module, tags added to URLs to track and analyze the performance of online marketing campaigns from the Newsletter tool.
Preamble
- These UTM tags, which are optional, consist of specific parameters such as source, medium, campaign, term, and content, which help identify the origin of a link's traffic.
- By using UTM tags, marketers can understand which campaigns generate traffic, which channels are most effective, and which ads or strategies work best, based on data collected by web analytics tools.
- The UTM tags thus allow you to create a match between the links present in your newsletters and the tracking of a tool like Google Analytics on your site.
Enable the UTM feature
To access your Newsletter:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- If necessary, click on the domain name concerned in the table that appears.
- The interface of the Newsletter appears.
Enable this option in the very first step of creating your Newsletter. You will find three fields allowing you to enter keywords of type utm_parameters:
- campaign source (utm_source)
- campaign medium (utm_medium such as email for example)
- campaign name (utm_campaign = the name of your campaign for example)
So:
- Fill in the 3 UTM fields in step 1 of Newsletter creation.
- Insert a link to the URL of your site (the latter must be properly configured and analyzed by Google Analytics, for example) in the body of the Newsletter in step 3.
- When the reader clicks on it, they will be taken to the URL followed by the terms "
?utm_source=...&utm_medium=...&utm_campaign=...
" with obviously your keywords in place of "...
".
If you enter multiple keywords in these fields, any spaces will be replaced with underscores underscore _
.
Later, it is planned to be able to enter dynamic formulas in these fields, such as today's date for example. Also, refer to the article https://news.infomaniak.com/comment-creer-un-objectif-google-analytics.
This guide presents several examples of using Varnish on Cloud Server Infomaniak.
⚠️ For additional help contact a partner or launch a free tender — also discover the role of the host.
Varnish Configuration
After installation, configuring Varnish includes important rules for caching and purging. Be careful not to accidentally allow unwanted IP addresses.
Here is what a basic configuration file might look like with a few common cases and different actions/rules in one example:
vcl 4.0;
# Configuration du backend par défaut
backend default {
.host = "127.0.0.80"; # Adresse IP du backend
.port = "80"; # Port du backend
}
# Définition d'une liste de contrôle d'accès (ACL) pour les IPs autorisées à purger le cache
acl purge {
"localhost"; # IP locale
"1.2.3.4"; # IP de votre domicile
"42.42.42.0"/24; # Plage d'IP publique de votre entreprise
! "42.42.42.7"; # Exclusion d'une IP spécifique (ex : un collègue gênant)
}
# Traitement des requêtes à leur réception par Varnish
sub vcl_recv {
# Autoriser les requĂŞtes de purge
if (req.method == "PURGE") {
# Vérification si l'IP du client est autorisée à purger
if (!client.ip ~ purge) { # 'purge' fait référence à l'ACL définie plus haut
# Retourne une page d'erreur si l'IP n'est pas autorisée
return (synth(405, "Cette IP n'est pas autorisée à envoyer des requêtes PURGE."));
}
# Si l'IP est autorisée, purger le cache pour cette requête
return (purge);
}
# Autoriser la purge de toutes les images via une requĂŞte PURGEALL
if (req.method == "PURGEALL" && req.url == "/images") {
if (!client.ip ~ purge) {
return (synth(405, "Cette IP n'est pas autorisée à envoyer des requêtes PURGE."));
}
# Invalider tous les objets en cache correspondant Ă des images
ban("req.url ~ \.(jpg|png|gif|svg)$");
return (synth(200, "Images purgées."));
}
# Ne pas mettre en cache les pages avec une autorisation (header Authorization)
if (req.http.Authorization) {
# Passer la requĂŞte directement au backend sans la mettre en cache
return (pass);
}
}
# Traitement de la réponse du backend avant de la renvoyer au client
sub vcl_backend_response {
# Mise en cache des images pour une durée de 1 jour
if (beresp.http.content-type ~ "image") {
set beresp.ttl = 1d;
}
# Si le backend indique que la réponse ne doit pas être mise en cache, respecter cette consigne
if (beresp.http.uncacheable) {
set beresp.uncacheable = true;
}
}
Purge from the CLI interface
From there, the rules stated in the configuration above apply to all requests, so if the configured site is "domain.xyz", you can simply use the CLI tool "curl
" and do the following:
# Envoyer une requĂŞte PURGE pour purger la page d'accueil de "domain.xyz"
$ curl -X PURGE https://domain.xyz/
# Réponse renvoyée par le serveur Varnish
<!DOCTYPE html>
<html>
<head>
<title>200 Purged</title>
</head>
<body>
<h1>Erreur 200 : Purge effectuée</h1>
<p>La page a été purgée avec succès.</p>
<h3>Guru Meditation:</h3>
<p>XID: 2</p>
<hr>
<p>Serveur de cache Varnish</p>
</body>
</html>
And there, the homepage has been purged. Or to purge another URL, simply point the request to the latter:
# Envoyer une requête PURGE pour purger un fichier spécifique à "domain.xyz"
$ curl -X PURGE https://domain.xyz/some_path/some_file.html
# Réponse renvoyée par le serveur Varnish
<!DOCTYPE html>
<html>
<head>
<title>200 Purged</title>
</head>
<body>
<h1>Erreur 200 : Purge effectuée</h1>
<p>Le fichier a été purgé avec succès.</p>
<h3>Guru Meditation:</h3>
<p>XID: 4</p>
<hr>
<p>Serveur de cache Varnish</p>
</body>
</html>
Or, as indicated in the VCL configuration, purge all images:
# Envoyer une requĂŞte PURGEALL pour purger toutes les images dans "domain.xyz"
$ curl -X PURGEALL https://domain.xyz/images
# Réponse renvoyée par le serveur Varnish
<!DOCTYPE html>
<html>
<head>
<title>200 Purged images</title>
</head>
<body>
<h1>Erreur 200 : Images purgées</h1>
<p>Toutes les images ont été purgées avec succès.</p>
<h3>Guru Meditation:</h3>
<p>XID: 32770</p>
<hr>
<p>Serveur de cache Varnish</p>
</body>
</html>
Purge from a CMS
It is a bit more difficult to illustrate this case because there are many ways to manage caching from a backend. In the configuration example above, a control on the header "Uncacheable
" is added, which disables caching. With this option, any CMS could simply set this header on the response to disable caching for this request, for example.
From any PHP code and with the configuration above, you can simply send an HTTP request and use this snippet to perform a PURGE of the cache:
<?php
if ($curl = curl_init("http://127.0.0.1/some_url")) {
curl_setopt_array($curl, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PURGE",
CURLOPT_HTTPHEADER => [
"Host: {$_SERVER['HTTP_HOST']}"
]
]);
curl_exec($curl);
if (curl_getinfo($curl, CURLINFO_HTTP_CODE) == 200) {
echo "Cache purged!";
}
curl_close($curl);
}
?>
Learn more
Useful links regarding the Varnish configuration language (VCL) to control request processing, routing, caching and several other aspects:
This guide explains how to install and configure systemd
on a Serveur Cloud and presents the main commands that can be used.
⚠️ For additional help contact a partner or launch a free tender — also discover the role of the host.
Prerequisites
- Follow the installation guide for
systemd
on Serveur Cloud. - Consult the official documentation to learn about all the possibilities offered by systemd
- The "unit" files must be placed in:
~/.config/systemd/user/ (/home/clients/absolute-path-id/.config/systemd/user)
(replacing absolute-path-id visible in your Manager) and the permissions must be set to 0644. - The
--user
parameter must be specified in each command.
Main commands
Here is a non-exhaustive list of commands that can be used with systemd
.
Force systemd
to reload the unit files and take the changes into account:
systemctl --user daemon-reload
Activating a service:
systemctl --user enable --now SERVICENAME.service
Checking the status of a service:
systemctl --user status SERVICENAME.service
Configuration of Node as a service with systemd
It will be necessary to create a "Unit" file with the ".service" extension, which will need to be saved in the directory:
~/.config/systemd/user/
It is possible to reuse the example below by replacing the values starting with {}:
[Unit]
Description={Le nom du service} # Spécifier ici un nom du service. Celui-ci est obligatoire mais n'a pas d'impact sur le fonctionnement
[Service]
Restart=always
Environment=NODE_VERSION={la version souhaitée} # Spécifier ici la version de Node à utiliser. S'assurer qu'elle soit installée au préalable avec "nvm install {la version souhaitée}"
WorkingDirectory=%h/{repertoire du projet Node} # %h correspond à la racine de l'hébergement
ExecStart=/bin/bash -c "exec $HOME/.nvm/nvm-exec {commande de lancement du script node}" # Cette commande dépend du projet. Par exemple, "npm run start", "npm run serve" ou encore "node server.js" sont courants
[Install]
WantedBy=default.target
Additional actions with a Unit file
systemctl --user daemon-reload
Start the service (if it is already active, nothing happens):
systemctl --user start [Nom du Unit]
Stop the service (if it is not active, nothing happens):
systemctl --user stop [Nom du Unit]
Restart the service (if it is not running, it will be started):
systemctl --user restart [Nom du Unit]
Get information about the service; namely:
- "Active" which indicates whether the service is running and for how long
- "CGroup" shows the process group managed by the service, this allows you to see the active processes, with their arguments and their ID
Below "CGroup" are any logs (the standard output and error of the process):
systemctl --user status [Nom du Unit]
Enable automatic startup of the service at server boot; NB: this does not start the service:
systemctl --user enable [Nom du Unit]
Disable the automatic startup of the service at server boot; NB: this does not stop the service:
systemctl --user disable [Nom du Unit]
Configuration with user entries:
[Unit]
Description="nom service"
[Service]
Restart=always
Environment=NODE_VERSION=16.17
WorkingDirectory=%h/sites/"nom-repertoire-site"/
ExecStart=/bin/bash -c "exec $HOME/.nvm/nvm-exec npm run start"
[Install]
WantedBy=default.target
This guide details how to import data from iCloud using rClone on kDrive Infomaniak.
COMPATIBILITY my kSuite ✗‍‍ | my kSuite+ ✗‍ ✔‍= Compatible offer | ✗‍= Not available |
Preamble
- Since Apple does not offer an API like its competitors, one solution to retrieve documents from an iCloud Drive is to install the app kDrive macOS to synchronize the icloud folder, which should be in your library. The guide below offers a solid alternative.
1. Set up rclone for drive access
Installing rclone on your computer
There is a version of rclone with a graphical interface (GUI) but it is quite possible to do this via command line (CLI):
- Install rclone from a terminal application on your device by entering the following command:
sudo -v ; curl https://rclone.org/install.sh | sudo bash
- Enter the password for your session on your computer to start the installation:
- Refer to the official installation guide if necessary.
Configuration of the remote drive (iCloud) on rclone
- Once rclone is installed, enter the command
rclone config
.- Refer to the official configuration guide if necessary.
- Then choose to configure a new remote import by answering
n
forNew remote
. - Name the remote disk, for example
appledrive
: - Then choose the type of drive to import by responding with
iclouddrive
, which corresponds to iCloud Drive among the options offered. - Specify the
apple_id
to rclone by entering your Apple ID (usually an email address). - Choose to use your own password linked to the Apple ID account (
y
). - Enter your password twice as prompted:
- Answer “No”
n
to the question about “advanced configuration”. - A window on your device should open to warn you of a remote connection; authorize it:
- A window on your device should open with a 2FA code; copy it:
- Paste the code when rclone it asks you.
- Answer “Yes”
y
to the last question if all the presented information is correct.
Setting up the destination drive (kDrive) on rclone
It is possible to act directly on the configuration file of rclone by pasting your kDrive configuration in the following format, for example:
[kDrive]
type = webdav
url = https://kDrive_ID_HERE.connect.kdrive.infomaniak.com/
vendor = other
user = user@email.com
pass = PASSWORD_HERE_OR_APP_PASSWORD_IF_2FA
But here is how to proceed step by step, just like for the previous configuration:
- Still in the terminal, enter
n
for a new disk configuration and enter the namekDrive
to recognize your destination disk: - Then choose the type of disk to import by entering
webdav
, which corresponds to a WebDAV configuration among the options offered. - Enter the following information:
url
= direct access to kDrive (refer to this other guide regarding the kDrive ID for the connection URL)vendor
= rclone (option number 6)user
= email address for logging into the Infomaniak user account
- Answer “Yes”
y
when prompted for the password, then enter the password:- application password if two-factor authentication is enabled or‍ the one for your Infomaniak user account if you have not enabled 2FA.
- Leave
bearer_token
empty, then answer “No”n
to the question about “advanced configuration”. - Answer “Yes”
y
to the last question and your 2 drives will be displayed:‍
2. Copy iCloud data to kDrive
Prerequisites
- Check the available options on the official guide before starting an import.
Example command to start copying your iCloud data to the root of your kDrive:
sudo rclone copy appledrive: kDrive:
This will instantly start copying your folders, subfolders, and iCloud contents to your personal folder in your Infomaniak kDrive!
Details about the dates of your exported photos
If you export your photos from iCloud to kDrive Infomaniak, be mindful of the date metadata. During export, the file creation dates may be altered and replaced with the export date instead of the original capture date.
Here is a script for advanced users that allows you to restore the correct data to your files from the EXIF information (it is recommended to process batches of 7000 photos max. to avoid a crash):
- Download ExifTool https://exiftool.org/index.html (MacOS Package).
- Install the application by allowing it to open beforehand if necessary:
- Open Script Editor (located in your Applications > Utilities folder):
- Click on New document.
- Copy and paste the long script below into the Script Editor window.
- Click on Run to start the script, a window opens:
- Select the folder to analyze.
- Let the script run, it will modify the dates or write errors in a file errors.txt on the desktop.
The script to copy and paste in full:
-- remplace date du fichier par la date exif creation
tell application "Finder"
set Chemin to choose folder with prompt "Sélectionnez le dossier contenant les fichiers à redater"
my inspecter(Chemin)
end tell
on inspecter(un_dossier)
tell application "Finder"
-- traitement des fichiers :
set les_fichiers to files of un_dossier
repeat with chaque_fichier in les_fichiers
-- traitement d'un fichier
set lefichier to chaque_fichier
set AppleScript's text item delimiters to {""}
set nom to name of chaque_fichier --récupère le nom du fichier
set extens to document file nom in un_dossier --recupere l extension du fichier
set lextension to name extension of extens
set sauv to AppleScript's text item delimiters --sauvegarder la variable delimiteur
set AppleScript's text item delimiters to {"."} --récupère la partie avant le dernier "."
set elements to text items of nom
set nomcourt to (items 1 thru -2 of elements) as string
set ancien_nom to nomcourt
set AppleScript's text item delimiters to sauv --restaurer la variable delimiteur
set chaque_fichier to chaque_fichier as string
try
set datephoto to do shell script "/usr/local/bin/exiftool -DateTimeOriginal " & quoted form of POSIX path of chaque_fichier
if datephoto is "" then set datephoto to do shell script "/usr/local/bin/exiftool -CreationDate " & quoted form of POSIX path of chaque_fichier
if datephoto is "" then set datephoto to do shell script "/usr/local/bin/exiftool -CreateDate " & quoted form of POSIX path of chaque_fichier
on error
-- Ecrit un fichier erreur sur le bureau si erreur chargement date
set lelog to open for access ((path to desktop folder as text) & "errors.txt") as text with write permission
write "Le fichier ne contient pas de date : " & chaque_fichier & return to lelog starting at eof
close access lelog
set datephoto to ""
end try
if length of datephoto > 20 then
set x to (length of datephoto) - 33
set DateOriginale to text -x thru -1 of datephoto
set ladate to text 1 thru 5 of DateOriginale
set lannee to ladate
set ladate to ladate & text 7 thru 8 of DateOriginale
set lemois to text 7 thru 8 of DateOriginale
set ladate to ladate & text 10 thru 11 of DateOriginale
set lejour to text 10 thru 11 of DateOriginale
set ladate to ladate & text 13 thru 14 of DateOriginale
set lheure to text 13 thru 14 of DateOriginale
set ladate to ladate & text 16 thru 17 of DateOriginale
set lesminutes to text 16 thru 17 of DateOriginale
set ladate to ladate & "." & text 19 thru 20 of DateOriginale
set lessecondes to text 19 thru 20 of DateOriginale
set newnom to lannee & "-" & lemois & "-" & lejour & " " & lheure & "." & lesminutes & "." & lessecondes
set xxx to ladate as string
if xxx is " 000000000000.00" then
-- Ecrit un fichier erreur sur le bureau si erreur chargement date(=0000...)
set lelog to open for access ((path to desktop folder as text) & "errors.txt") as text with write permission
write "Le fichier ne contient pas de date : " & chaque_fichier & return to lelog starting at eof
close access lelog
else
do shell script "touch -t " & ladate & " " & quoted form of POSIX path of chaque_fichier
end if
end if
if datephoto is not "" then
else
set lelog to open for access ((path to desktop folder as text) & "errors.txt") as text with write permission
write "Le fichier ne contient pas de date : " & chaque_fichier & return to lelog starting at eof
close access lelog
end if
end repeat
-- traitement des dossiers :
set les_dossiers to folders of un_dossier
repeat with chaque_dossier in les_dossiers
-- traitement d'un dossier
my inspecter(chaque_dossier)
end repeat
end tell
end inspecter
tell application "Finder"
(display dialog ("waouou ... Ca y est c'est fait !") buttons {"Salut !"})
end tell
This guide explains how to create rules sorting to automatically classify your incoming emails on Infomaniak according to certain conditions.
Preamble
- These rules allow for the following automatic actions:
- Remove or move messages from e-mail addresses you don't want to see anymore.
- Transfer to your spouse e-mails from an e-mail address so that both of you can receive them.
- Copy messages that contain a specific keyword to a folder.
- etc.
- In contrast to the Proposed sorting rules within software/mail clients (Microsoft Outlook, Mozilla Thunderbird, Apple Mail...), these rules will act directly on the server of your mailboxes even before IMAP connection.
- You can make one. model for the entire address of your Mail Service.
- If you are using a POP-configured mail client/software, in parallel with Mail, messages classified in folders will no longer be downloaded by your application because the POP protocol only tracks messages in your main inbox. To view classified messages, it will be necessary to use the IMAP protocol or only Mail Infomaniak.
Access rules from the Mail Infomaniak Web app
Prerequisites
- Have an email offer paid (offers) free are limited to Standard mode without the ability to create a filter to transfer an e-mail to another e-mail address e.g.).
- Having permission to managing the rules: if you had been invited on Web app Mail Infomaniak (online service) mail.infomaniak.com)in order to manage your address, it is possible that the Mail Service Manager will have youwithdrawn this right from its admin account.
To access the sorting filters for your Infomaniak email:
- Click here to access the web app Mail Infomaniak (online service) mail.infomaniak.com).
- Click on the icon Parameters ‍ Top right.
- Check or select the relevant email address from the drop-down menu.
- Click on Filters and rules:
Set a rule based on an email received
You can also create a rule directly from the email received:
- Click here to access the Mail Infomaniak Web app (online service) mail.infomaniak.com).
- Open the message from the sender concerned.
- Click on the action menu â‹® at the top right of the open message.
- Choose Create a Rule to open the creation wizard that will be pre-filled with the message elements:
‍
Accessing the rules from the Service Mail
To access the sorting filters for your Infomaniak email:
- Click here in order to access the management of your product on the Manager Infomaniak (Need help?).
- Click directly on the nameallocated to the product concerned.
- Click on the email address concerned in the table that appears.
- Click on the tab Filters and rules from the left side menu:
Configure Filters & Sorting Rules
Create a new rule in mode Standard
- Click on the button Add Rule in mode Standard to create a new rule using a creation assistant/form:
- The different conditions available for sorting filters are presented in this other guide.
- Once a filter has been created, click on Continue to activate it.
Add or modify a rule in mode Standard
If there are already sorting filters, the button ‍ to add it is at the top right of the table:
These settings can be changed when you want by clicking on the icon pencil located to the right of the element concerned.
Create a new rule in mode Advanced (expert)
- Advanced mode allows you to configure sorting rules directly from a script in Sieve language.
- It is possible to import Sieve files via the button.
- By activating this mode, existing rules will be retained but disabled.
First example of advanced sorting
Here is a simple example of a command using this language:
require ["fileinto"];
if address :contains "from" "facebook.com" {
fileinto "fb";
} elsif header :matches "List-Unsubscribe" "*" {
fileinto "nl";
} else {
keep;
}
Explanations:
- Loading the required extensions : use
require ["fileinto"];
to indicate that you will use the functionfileinto
. - Filtering Facebook Messages : use
if address :contains "from" "facebook.com"
to check if the sender's address contains "facebook.com"; if yes, the message is classified in the folder "fb" withfileinto "fb";
. - Filtering messages with an unsubscribe link : use
elsif header :matches "List-Unsubscribe" "*"
to check if the "List-Unsubscribe" header is present in the message; if so, the message is filed in the "nl" folder withfileinto "nl";
. - Retention of other messages : use
else { keep; }
to keep all other messages that do not meet the above criteria.
Attention:
- If you need to mention a subfolder, use the separator
/
(as in the second example), but it is not necessary to specifyINBOX
in your codes - Make sure the folders "
fb
" and "nl
" already exist in your inbox; otherwise, messages may not be sorted correctly - The filter
address :contains "from" "facebook.com"
works correctly for addresses that contain "facebook.com"in the "from" field - The filter
header :matches "List-Unsubscribe" "*"
check only the presence of the "List-Unsubscribe" header, not its contents
Second example of advanced sorting
This code modifies the object according to theSender (adds a prefix to the object when an e-mail passes the filter, e.g.):
require ["fileinto", "editheader", "variables", "regex"];
if address "sender" "owner-scientific-linux-devel at LISTSERV.FNAL.GOV" {
if header :regex "subject" "((Re|Fwd): *)\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)" {
deleteheader "Subject";
addheader "Subject" "${1}${3}";
} else {
# Ajouter un préfixe si l'objet ne correspond pas déjà au modèle
deleteheader "Subject";
addheader "Subject" "[SL-Devel] ${1}";
}
fileinto "Mail List/SL-Devel";
}
Explanations:
- Extensions required :
fileinto
: to classify messages in folders.editheader
: to change the headers of emails.variables
: to use variables in expressions.regex
: for regular expressions.
- Condition on sender :
if address "sender" "owner-scientific-linux-devel at LISTSERV.FNAL.GOV"
Check if the sender matches.
- Condition on the object :
if header :regex "subject" "((Re|Fwd): *)\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)"
: check if the object corresponds to the specified model.deleteheader "Subject";
andaddheader "Subject" "${1}${3}";
: deletes the existing object and adds a new object with the captured parts.
- Adding a prefix if the object does not already match the model :
addheader "Subject" "[SL-Devel] ${1}";
: adds a prefix "[SL-Devel]" to the object if it is not already present.
- Classification of message :
fileinto "Mail List/SL-Devel";
: Classifies messages in the "Mail List/SL-Devel" folder.
Attention:
- Make sure the folder "
Mail List/SL-Devel
" already exists in your inbox. - Check that the script correctly modifies the subject of the emails to add or adjust the prefix if necessary.