Knowledge base
1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Fix an email error ($ in password)
This guide details the specific rules to follow when using a password containing the "dollar" character $
to send an email via the SMTP Infomaniak in a script (PowerShell, Python, etc.).
Preamble
- If you encounter an authentication error (for example
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 advised to avoid any special character with syntactic meaning, particularly
$
, in passwords used in scripts and configuration files. - The issue may also occur when connecting to databases.
Rules to follow
The character $
is a special symbol in many languages and environments. When it is used in a password in a script or configuration file, it can be mistakenly interpreted as a variable or control character.
Here are frequent 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 (for example 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 improperly 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 absolutely must use it, always enclose the password string correctly according to the language:
- In PowerShell: use single quotes
'password$Test'
if possible. - In Python: ensure the string is well enclosed in single or double quotes, without interpretation.
- In Bash: escape the
$
with a backslash\$
.
- In PowerShell: use single quotes
Link to this FAQ: