Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Fix an email error ($ in the password)

This guide details the specific rules to follow when using a password containing the “dollar” character $ to send an email via the Infomaniak SMTP in a script (PowerShell, Python, etc.).

 

Preamble

  • If you encounter an authentication error (e.g., auth failed, invalid login or password) when sending an email via SMTP, even though the password is correct and works in software like Outlook, the issue may be due to the handling of the $ character in your script or configuration file.
  • To ensure reliable execution of your SMTP scripts, it is strongly recommended to avoid any special characters with syntactic meaning, particularly $, in passwords used in scripts and configuration files.
  • The problem may also occur when connecting to databases.

 

Rules to follow

The character $ is a special symbol in many languages and environments. When used in a password in a script or configuration file, it may be mistakenly interpreted as a variable or control character.

Here are common cases where you should not use the character $ in a password:

  • PowerShell: $ is used to declare variables. A password containing $ can cause syntax errors or be truncated.
  • Bash / Shell (Linux): $ is also a variable prefix. It can trigger unexpected substitutions.
  • YAML files (e.g., Home Assistant, GitHub Actions, Docker Compose): $ can be interpreted as an environment variable.
  • Files .env, .ini, or other configuration files: the tools that read these files may attempt to interpret the variables.
  • Commands or URLs with authentication: a password containing $ may be incorrectly encoded or fail during parsing.

 

To correct or prevent this type of error:

  • Avoid using the character $ in passwords intended for use in scripts or automated systems.
  • If you must use it, always properly enclose the password string according to the language:
    • In PowerShell: use single quotes 'password$Test' if possible.
    • In Python: ensure the string is properly enclosed in single or double quotes, without interpretation.
    • In Bash: escape the $ with a backslash \$.

Has this FAQ been helpful?