Sign inSign up

vistanarvas/msmtp

By vistanarvas

•Updated about 2 years ago

send mail from container

Image
1

562

vistanarvas/msmtp repository overview

⁠msmtp

status-badge

send mail from your container
this image is intended to be used in a CI piple

source code here⁠

⁠Environment variables

Variable NameRequeredDescriptionExample
SMTP_HOSTYesThe smtp url of your email serversmtp.gmail.com
SMTP_PORTnoThe smtp port usually 25, 465 or 587 this is the default587
SMTP_FROMYesYour email address[email protected]
SMTP_USERYesYour username for the server
usually the same as your email addres or the part before the @
my_email
SMTP_PASSWORDYesits where the password go's
the password gets stored in plaintext on the container
Hunter22
EMAILNoThe "raw" emailExample here⁠
TO_ADDRESSESYesThe adress or addresses to send to
to send to multiple addresses add , (comma and space) betean each address
[email protected], [email protected]
SUBJECTNoThe email subjecttext
MESSAGENoThe body off the emaillots of text
SMTP_AUTHNoenable/disable authentication
Valid values are off or on this is the default
on
SMTP_TLSNoenable/disable TLS encryption
Valid values are off or on this is the default
on
⁠Environment variables files

it is also posable subsitute the variables above⁠ 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 NameDescription
MSMTP_CONFIG_FILEThis is the config file msmtp uses
this replaces the need for most other Environment variables
When you use this only EMAIL or TO_ADDRESSES, SUBJECT, MESSAGE are requered
to see what the file sould contain have a look at the Documentation⁠ or a Example⁠
the file MUST have permissions⁠ set to 600
SMTP_HOST_FILE
SMTP_PORT_FILE
SMTP_FROM_FILE
SMTP_USER_FILE
SMTP_PASSWORD_FILE
EMAIL_FILE

⁠Writing the email

There are 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: [email protected]
Subject: The subject (followd by a empty line)

This is the first like of the body

⁠CI example

pipeline:
    send_mail:
        image: vistanarvas/msmtp
        secrets:
            -   source: email_password
                target: SMTP_PASSWORD
            -   source: email_user
                target: SMTP_USER
            -   source: email_user
                target: SMTP_FROM
        environment:
            - SMTP_HOST=smtp.gamil.com
            - [email protected], [email protected]
            - SUBJECT=title of the email
            - MESSAGE=body of the email

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

NameSMTP_HOSTSMTP_PORT
Gmailsmtp.gmail.com587
Outlooksmtp-mail.outlook.com587
Yahoosmtp.mail.yahoo.com587

Tag summary

Content type

Image

Digest

sha256:0e808796f…

Size

8 MB

Last updated

about 2 years ago

docker pull vistanarvas/msmtp