Coder Social home page Coder Social logo

vanderblugen / send-emails-from-linux-with-postfix Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 23 KB

Yet another way to configuring Linux to send emails using mailutils and postfix.

linux email emails gmail mail postfix sasl raspberry-pi raspberrypi starttls

send-emails-from-linux-with-postfix's Introduction

Send Emails from Linux with Postfix

This is for configuring Linux to be able to send emails.

This information was obtained from here for my enjoyment and so I don't have to look for this again. . This has been tested on a Raspbery pi and an Ubuntu machine.

This configuration uses Gmail as the email carrier. It will work with others, just used gmail in this configuration. Less secure apps or 2 factor with app passwords needs to be enabled for this configuration to work.

Install needed apps

sudo apt-get install postfix libsasl2-modules mailutils -y

Select internet site on installation

Add email password

sudo nano -B /etc/postfix/sasl/sasl_passwd

Add smtp.gmail.com:587 [email protected]:password with the appropriate information

Crtl+X' and Enter` to save and exit

Update the password file

sudo chmod u=rw,go= /etc/postfix/sasl/sasl_passwd
sudo postmap /etc/postfix/sasl/sasl_passwd

Edit postfix configuration file

sudo cp /etc/postfix/main.cf !#$.dist
sudo nano /etc/postfix/main.cf

Change relayhost = to relayhost = smtp.gmail.com:587

Change smtp_tls_security_level=may to #smtp_tls_security_level=may

Add this at the bottom

# Enable authentication using SASL.
smtp_sasl_auth_enable = yes
# Use transport layer security (TLS) encryption.
smtp_tls_security_level = encrypt
# Do not allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# Specify where to find the login information.
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
# Where to find the certificate authority (CA) certificates.
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Exit and Save with Ctrl+X and Enter

Restart Postfix

sudo service postfix restart

Send a test email

echo "Subject: Test Email Subject" | mail -a [email protected] < echo "Here is a test email"

send-emails-from-linux-with-postfix's People

Contributors

vanderblugen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.