Open-source News

Travel off the grid and still send emails with putmail

opensource.com - Tue, 05/17/2022 - 15:00
Travel off the grid and still send emails with putmail Kevin Sonney Tue, 05/17/2022 - 03:00 Register or Login to like Register or Login to like

Automation is a hot topic right now. In my day job as an SRE part of my remit is to automate as many repeating tasks as possible. But how many of us do that in our daily, not-work, lives? This year, I am focused on automating away the toil so that we can focus on the things that are important.

In "normal times" my wife and I travel a lot. And as anyone who similarly travels a lot knows, connectivity can be very expensive. We were recently on a cruise and the "Premium" ship-board internet cost upwards of $200 for the full 7 days, and even then it had all the drawbacks of satellite internet in terms of speed and congestion. So to make my life easier, I set up offlineimap to download my mail, dovecot to let me use an IMAP client to read my mail, and msmtp to send mail from my various accounts. I covered much of this setup in 2020, and the rest is documented in many places online.

More great content Free online course: RHEL technical overview Learn advanced Linux commands Download cheat sheets Find an open source alternative Explore open source resources

What is not often discussed is that you still need to be online to send mail. The most common recommended solution for sending mail is msmtp, and it always rejects mail if it can't connect to the desired host. But it does have a daemon option (msmtpd) that can be used to accept local SMTP connections and forward them to another program. By default, this is msmtp itself. But again, I don't want to send things now, I want to send things when I have a connection, which is when I stumbled upon putmail.

Putmail is a set of Python scripts that sends mail to pre-configured smtp servers based on the From address in a mail message. It is stable (unmodified since 2011), and just works. If you, like me, have multiple email addresses which have to be sent via multiple SMTP relays, this is just the thing you need. Each email address you send from has its own configuration file, and since putmail decides on which to use based on the message itself, there's no need to have to set up multiple sending setups in a single mail client.

As an example, to send with a gmail account, you would create the file .putmail/yourname@gmail.com and fill in the following information.

yourname@gmail.com putmail configuration
[config]
email = yourname@gmail.com
server = smtp.gmail.com
port = 587
username = yourname@gmail.com
password = XXXXXXXXXXXXXXXXX
tls = on

And that's it. Configure a mail client to send via putmail.py instead of sendmail or msmtp and send a message.

The next best things are the putmail_enque.py and putmail_dequeue.py scripts. The first takes an email and stores it to send later. The second loops through the queue and delivers the mail. By specifying putmail_enqueue.py as the program msmtpd runs, I can "send" an email now, and it just waits for me to run putmail_dequeue.py later. Here is my msmtpd startup command, specifying putmail_enqueue.py as the item to be used for mail delivery.

msmtpd --port=1025 --log=/tmp/msmtpd.log --command='putmail_enqueue.py -f %F' -

I use the following script as a presynchook in offlineimap to check to see if I am connected, and if so, send mail.

#!/bin/bash
echo Sending queued messages \(if any\)
QUEUEDMAIL=$(find $HOME/.putmail/queue -type f | wc -l)
if [ $QUEUEDMAIL -ne 0 ]; then
  ping -n -c 1 imap.gmail.com >/dev/null 2>/dev/null
  if [ $? -eq 0 ]; then
    putmail_dequeue.py
  fi
fi

After all that, I can use any mail client I wish and send mail with a standard SMTP call to localhost:1025 and have it delivered next time I'm connected to the internet. And the best part is, I don't have to change my workflow for email if I'm home or traveling — it all just happens automatically in the background.

Configure your mail client to automatically send emails next time you have an internet connection.

Email What to read next Manage your Gmail filters from the Linux command line This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

4 ways you can preserve the Earth's livability with open source

opensource.com - Tue, 05/17/2022 - 15:00
4 ways you can preserve the Earth's livability with open source Tobias Augspurger Tue, 05/17/2022 - 03:00 Register or Login to like Register or Login to like

Earth's uniqueness in creating a stable environment for life in a completely hostile space is a miracle. Various life forms have taken billions of years to build up the natural resources humans depend on, such as a protective atmosphere, fertile soil, stable weather, and clean drinking water.

As a movement to democratize technology development and knowledge creation, open source has the potential to become the central driver in preserving this stability. Here are four different ways you can preserve the livability of the planet by using, supporting, and participating in open source projects, and more than 20 resources to help you get started.

Measure, optimize, and reduce

Before taking action, it is important to assess your impact on the environment in a scientific way. With more accurate information, you can focus your efforts where the most potential lies. Open science discloses the models behind these measurements, which reduces uncertainties in the long term through continuous improvement and observation. Open source tools make it possible to remain objective and make meaningful comparisons to guide decision making.

These decisions happen constantly, both in the consumption of everyday resources and in the use and development of digital products. Software developers find their work in digital products all over the world. Measuring and reducing the energy consumption of these products is the goal of open source tools like Scaphandre, Cloud Carbon Footprint, and kube-green. These tools help you track power consumption, estimate carbon emissions, and even shut down resources when they are not needed.

Image by:

Cloud Carbon Footprint is an open-source project, sponsored by Thoughtworks Inc
(Cloud Carbon Footprint, Apache License, Version 2.0)

The open source platform electricityMap calculates and predicts the carbon intensity of electric power consumption within electrical grids worldwide on an hourly basis. You or your business can take action by using this information to shift computation to times when there is a high share of renewable energy sources in the electricity grid, thereby reducing emissions.

The open source community of OpenEnergyMonitor enables people to monitor and understand the electrification of their homes. Open hardware and open source tools created by OpenEnergyMonitor track and log usage data from multiple categories, including electric vehicles, heat pumps, and photovoltaics. Their learning platform offers a deep understanding of the possibilities for increasing the use of sustainable energy in your household and becoming energy independent. At the heart of it all is the emonPi energy monitor and base station, which can bring together information about your energy consumption from multiple sensor nodes.

Image by:

The OpenEnergyMonitor Solar PV monitor provides real-time and historical information on solar generation and on-site consumption.
(OpenEnergyMonitor, CC BY-SA 4.0)

Understand the planet

The Earth is a highly complex system, which makes it vitally important to better understand the impact humans have on this system. Several open science and open source projects are working to improve transparency and cooperation in this area. Various tutorials offer beginners an introduction to the programming languages and tools used in this field. These tutorials allow you to improve your programming skills while simultaneously learning more about the environment.

An Introduction to Earth and Environmental Data Science provides a beginner-friendly introduction to the use of open source Python tools, how these tools can be used, and data science in general. Instead of introducing the basics of Python with routine robotics projects, learners discover how to use Python and programming tools to interpret data about the planet.

Image by:

Understanding and representing earth observation data, such as this map of sea ice concentration, is a central part of the Introduction to Earth and Environmental Data Science course.
(Tobias Auspurger, CC BY-SA 4.0)

The Climate Laboratory provides the perfect starting point for getting a deeper understanding of climate change and the physical science behind it. Like the previous example, this course includes tutorials to use Python, one of the main tools for climate scientists today. The textbook is a living document that has been created around climlab to provide a powerful but entry-level friendly tool for climate modeling.

Image by:

You can learn to make maps illustrating surface air temperature anomalies due to CO2 doubling.
(Tobias Auspurger, CC BY-SA 4.0)

Earth Lab provides Earth data science lessons that will help you learn how to work with data in the R and Python programming languages. All course material is open source. Nonspecialists who enroll in the Earth data analytics online course help ensure that understanding how the planet works is not just an academic exercise but also a field of knowledge used in all parts of society.

Observe the planet

Satellites provide a unique tool to map the state of the planet. Even small changes in our ecosystems such as greenhouse gas emissions, land use change, biodiversity loss, soil drought, or water pollution can be measured with high temporal and spatial resolution.. The data collected here are calibrated to the highest scientific standards and therefore provide an objective view of Earth. Recent years have seen a massive democratization of data and software tools in this field. NASA and ESA have published many data sets and tools from various satellite missions under a free license.

The condition of even the most remote forests can be assessed with the help of satellite images in different spectra. All kinds of forest health indicators can be derived from data, like deforestation risk, wildfire risk, or tree detection. By using and improving these tools, you can actively contribute to preserving this ecosystem. Only by measuring and disclosing such information can environmentalists demonstrate that habitats are being lost.

You can also learn how to process satellite data using modern image processing algorithms such as neural networks. One of the most robust communities in this field is Global Forest Watch. Here, multiple datasets are combined to give an interactive overview of the health of forests worldwide.

Image by:

Spatial probability of deforestation on Guadeloupe
(Tobias Auspurger, CC BY-SA 4.0)

Projects like Resource Watch and Radiant Earth provide entry-level platforms for people anywhere to understand natural resources based on Earth-observation technology. NASA provides its own open source platform, NASA Harvest, to map the state of crops, providing essential information about food security. Another way to get insights about possible hunger crises is the measurement of soil moisture, which is also possible from space with packages like smapr.

The ever-increasing resolution of satellite data in recent years means that even the impact of individual companies on the environment can be measured. This new field of science is called spatial finance, and its purpose is to guide business development and investment in alignment with good sustainability practices. The first open datasets in this field track the locations and  companies involved in cement production, iron and steel production, and global coal, oil, and gas supply chains. The Carbon Mapper platform shows how to build pressure on companies by disclosing methane and carbon dioxide sources.

Image by:

Global coal, oil, and gas asset-level data
(Lucas Kruitwagen, MIT License)

Demand openness

Environmental catastrophes are often accompanied by a cover-up and manipulation of scientific findings and information. This applies to climate change as well as local environmental impacts. UN Secretary-General Antonio Guterres has given a clear warning following the release of the international climate change report, which shows no trend reversal in global warming and the loss of biodiversity in 2022.

We are on a pathway to global warming of more than double the 1.5°C limit agreed in Paris. Some government and business leaders are saying one thing, but doing another. Simply put, they are lying. And the results will be catastrophic. This is a climate emergency.

Image by:

With the help of pyam you can process the data behind the latest UN report and thus better understand the different scenarios.
(pyam, Apache license)

One of the easiest ways to change course is to consistently demand open science concerning environmental issues. Openness is a key indicator of sustainable development, because anyone pursuing truly sustainable intentions is interested in refining their conclusions through open scientific discourse. Openness will also help prevent greenwashing, or the practice of promoting a company's sustainability efforts through marketing while scientific findings and conclusions about environmental impacts are downplayed or held private.

The next time you buy products that claim to be carbon neutral, ask for independent studies and data. If a politician demands questionable measures for environmental protection, ask for open model calculations and open access studies on this topic. Do you want to invest in a sustainable investment fund? Ask for open scientific studies, data, and models on why this investment is sustainable. Demanding openness in all these ways helps limit greenwashing and ensures that companies' environmental impacts are verifiable, accountable, and traceable.

Why actions rooted in open source culture can make a big impact.

Image by:

Seth Kenlon, CC BY-SA 4.0

Science Data Science What to read next This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License. Register or Login to post a comment.

Inkscape 1.2 Open-Source Vector Graphics Program Released

Phoronix - Tue, 05/17/2022 - 06:30
It's been nearly one year since the release of Inkscape 1.1 while today it has been succeeded by Inkscape 1.2 as a major feature update...

FreeBSD 13.1 Released With UEFI Boot Enhancements, Driver Improvements

Phoronix - Tue, 05/17/2022 - 06:12
After taking a few extra weeks to bake, FreeBSD 13.1 is out today as the newest stable release of this leading BSD operating system...

PNY XLR8 Gaming REV 2x8GB DDR4-3600 Memory

Phoronix - Tue, 05/17/2022 - 02:20
PNY recently sent over their new XLR8 Gaming REV 16GB (2 x 8GB) DDR4-3600MHz memory that only lists compatibility with Microsoft Windows 11 and older, but fear not, it does work fine for Linux gamers and others looking for DDR4-3600 memory with RGB lighting and running well with the latest Intel and AMD processors.

NVIDIA Updates Legacy 470 & 390 Series Linux Drivers, New Bump For 510 Series

Phoronix - Tue, 05/17/2022 - 00:30
While not as exciting as last week's NVIDIA 515 series Linux driver that kicks off their open-source Linux kernel driver effort, but today they issued a minor point release for the current stable 510 series as well as updating their prior legacy driver branches...

Pages