67 lines
3.6 KiB
Markdown
67 lines
3.6 KiB
Markdown
# msmtp
|
|
[](https://woodpecker.narvas.tech/vista/msmtp)
|
|
|
|
send mail from your container
|
|
this image is intended to be used in a CI piple
|
|
|
|
|
|
## Environment variables
|
|
|
|
| Variable Name | Requered | Description | Example
|
|
|--------------------|-----|------------------|--------
|
|
|`SMTP_HOST` | Yes | The smtp url of your email server | `smtp.gmail.com`
|
|
|`SMTP_PORT` | no | The smtp port usually `25`, `465` or `587` *this is the default* | `587`
|
|
|`SMTP_FROM` | Yes | Your email address | `my_email@gmail.com`
|
|
|`SMTP_USER` | Yes | Your username for the server<br>usually the same as your email addres or the part before the @ | `my_email`
|
|
|`SMTP_PASSWORD` | Yes | its where the password go's<br>*the password gets stored in plaintext on the container* | `Hunter22`
|
|
|`EMAIL` | No | The "raw" email | Example [here](#the-second-way)
|
|
|`TO_ADDRESSES` | Yes | The adress or addresses to send to<br> to send to multiple addresses add `, ` (comma and space) betean each address | `alice@outlook.com, bob@gamil.com`
|
|
|`SUBJECT` | No | The email subject | `text`
|
|
|`MESSAGE` | No | The body off the email | `lots of text`
|
|
|`SMTP_AUTH` | No | enable/disable authentication<br>Valid values are `off` or `on` *this is the default* | `on`
|
|
|`SMTP_TLS` | No | enable/disable TLS encryption<br>Valid values are `off` or `on` *this is the default* | `on`
|
|
|
|
### Environment variables files
|
|
it is also posable subsitute the variables [above](#environment-variables) with a file
|
|
to use this simpy take what you normaly use for the variable and put it in a file
|
|
and make the contents of the `_FILE` variable the path to that file
|
|
using this way other proccesses could provide the email content
|
|
all of these are optinal but when uses the overwrite the counterpart variable
|
|
| Variable Name | Description |
|
|
|--------------------|-------------|
|
|
|`MSMTP_CONFIG_FILE` | This is the config file msmtp uses<br>this replaces the need for most other Environment variables<br>When you use this only `EMAIL` or `TO_ADDRESSES`, `SUBJECT`, `MESSAGE` are requered<br>to see what the file sould contain have a look at the [Documentation](https://marlam.de/msmtp/msmtp.html#Configuration-files) or a [Example](https://marlam.de/msmtp/msmtprc.txt)<br>the file **MUST** have [permissions](https://linuxcommand.org/lc3_lts0090.php) set to 600
|
|
|`SMTP_HOST_FILE` |
|
|
|`SMTP_PORT_FILE` |
|
|
|`SMTP_FROM_FILE` |
|
|
|`SMTP_USER_FILE` |
|
|
|`SMTP_PASSWORD_FILE`|
|
|
|`EMAIL_FILE` |
|
|
|
|
## Writing the email
|
|
|
|
There a 2 ways to write the actual email
|
|
### the first way
|
|
provide the `TO_ADDRESSES` and `SUBJECT` and `MESSAGE` environment variables
|
|
this is a very basic and simple way to write the email
|
|
|
|
### the second way
|
|
provide the `EMAIL` environment variable
|
|
this is a more advanced way to write the email
|
|
using the `EMAIL` overwrites the `TO_ADDRESSES` and `SUBJECT` and `MESSAGE` environment variables
|
|
a basic `EMAIL` is formated like below
|
|
```
|
|
To: recipient@gmail.com
|
|
Subject: The subject (followd by a empty line)
|
|
|
|
This is the first like of the body
|
|
```
|
|
|
|
## Defaults for popular mail servers
|
|
if its not on the list figger it out yourself *and make a pull request*
|
|
tip: search for your servers imap clent settings usually it also lists smtp settings
|
|
| Name | `SMTP_HOST` | `SMTP_PORT` |
|
|
|---------|-------------------------|-------------|
|
|
| Gmail | `smtp.gmail.com` | `587` |
|
|
| Outlook | `smtp-mail.outlook.com` | `587` |
|
|
| Yahoo | `smtp.mail.yahoo.com` | `587` |
|