en-us pt-br

Using ActionMailer with Localhost


Some years ago I wrote a nice gist to setup an local Unix email delivering environment, for testing purposes.

In case you’re using Windows, I have one for you too.

Based on this, we’ll create an multi-environment mailer in Rails, using ActionMailer, which will send local emails using postfix for development, and can use any other configuration for production (including email services like SendGrid, SendinBlue, Amazon SES, Mandrill, Mailgun, etc).

I.e., locally we can test our Rails emails without rely on external services.

Before Start

Really, I’m assuming you have your postfix working like described in my gist.


Let’s start with a initializer, config/initializers/email.rb with the following content:

# config/initializers/email.rb
email_config = Rails.application.config_for :email

ActionMailer::Base.default_options = {
    from: email_config[:from]
ActionMailer::Base.raise_delivery_errors = email_config[:raise_delivery_errors]
ActionMailer::Base.smtp_settings = {
    user_name: email_config[:user_name],
    password: email_config[:password],
    domain: email_config[:domain],
    address: email_config[:address],
    port: email_config[:port],
    authentication: email_config[:authentication],
    enable_starttls_auto: email_config[:enable_starttls_auto],
    perform_deliveries: email_config[:perform_deliveries],
    delivery_method: email_config[:delivery_method]
unless email_config[:perform_deliveries]
  ActionMailer::Base.perform_deliveries = false

Then values for these configurations in /config/email.yml:

  # Some prod config here

  raise_delivery_errors: true
  domain: localhost
  perform_deliveries: true

  delivery_method: test

Testing in Rails Console

Assuming you have an email like activation_instructions for a user, you can test using the deliver_now method in rails console:



Rails.application.config_for has no support for common section in the yml file.

If you’re using any other initialization method that has support for common section, it’s better:

  • clear values for authentication, user_name and password
  • change enable_starttls_auto to false and
  • make sure port value is 25


  # Common config here

  # Some prod specific config here

  perform_deliveries: true
  port: 25
  enable_starttls_auto: false
  domain: localhost
  address: localhost

  delivery_method: test

Additional Configurations

If you want more emails options to include in your initializer, like a default value for reply_to, please check all options in Action Mailer Configuration doc.

Super Nintendo history


Exactly today is the release date for the Super Nintendo Classic, one of the most loved players’ consoles.

This version, similar to what happened to NES classic, is a miniaturized version, based on a Linux mini computer.

It has 20 games in the internal memory, including the never released Starfox 2, HDMI output and support for wireless gamepads.

SNES Classic SNES Classic

On its honor, I wrote a brief console story.

Using Wiimote as wireless mouse on Ubuntu


The Nintendo Wiimotes are really a nice way to interact with the desktop: you can use it as wireless mouse for presentations, as a classic old videogame gamepad or even as lightgun (aka zapper) for 8-bits emulators (like retroarch).

So, let’s install the required libraries and add some additional configurations to get it working as a wireless mouse.

Install from System Repository (Ubuntu 16.04, Retropie, Debian)

If you’re on Retropie, Debian or Ubuntu 16.04 (first release, i.e., no HWE), just install the standard xserver-xorg-input-xwiimote package:

sudo apt install xserver-xorg-input-xwiimote

Install from PPA (Ubuntu 16.04.1 or above)

If you’re in Ubuntu 16.04.1 or above (i.e., you’re using HWE), the default system package will not work with the following errors:

The following packages have unmet dependencies:
 xserver-xorg-input-xwiimote : Depends: xorg-input-abi-22
                               Depends: xserver-xorg-core (>= 2:

I’ve reported an issue and in this meanwhile built the updated package.

You can install it with:

sudo apt-add-repository -y ppa:rael-gc/utils
sudo apt update
sudo apt install xserver-xorg-input-xwiimote

Alternative: Manual build

This is not required if you got the package installed from system repository or from the PPA. Skip to Additional configurations in this case.

Build requirements

Install required packages on Retropie, Debian or Ubuntu 16.04:

sudo apt install xutils-dev xserver-xorg-dev libxwiimote-dev

If you’re under Ubuntu 16.04.1 or higher, install with:

sudo apt install xutils-dev xserver-xorg-dev-hwe-16.0 libxwiimote-dev

Then open a new terminal or do a logout/login.

Download sources

Git clone or manual download (and extract) from https://github.com/dvdhrm/xf86-input-xwiimote


cd xf86-input-xwiimote


sudo make install
sudo cp 60-xorg-xwiimote.conf /usr/share/X11/xorg.conf.d/

Additional configurations

The default config file for xf86-input-xwiimote is /usr/share/X11/xorg.conf.d/60-xorg-xwiimote.conf.

If you’re using the system package or the PPA install, this file will be overwritten every time the package is updated. A better idea should create a copy named /usr/share/X11/xorg.conf.d/61-xorg-xwiimote.conf and use it to avoid package overwrite.

Enable IR

Of course, enable IR if you’re using a USB Wii sensor bar.

Edit the config file and add under “Nintendo Wii Remote” section:

	Option "MotionSource" "ir"

Enable mouse clicks

By default, if you press wiimote button A, it’ll produce a Enter key press.

To change this, edit the config file and add under “Nintendo Wii Remote” section:

	Option "MapIRA" "left-button"
	Option "MapIRB" "right-button"

Mimic 8bitdo Zero gamepad in keyboard mode

Edit the config file and add under “Nintendo Wii Remote” section:

	Option "MapOne" "KEY_G"
	Option "MapRight" "KEY_J"
	Option "MapLeft" "KEY_D"
	Option "MapRight" "KEY_C"
	Option "MapUp" "KEY_E"
	Option "MapDown" "KEY_F"
	Option "MapPlus" "KEY_O"
	Option "MapMinus" "KEY_N"
	Option "MapHome" "KEY_ESC"

Restart X.org

You’ll need to restart your X.org to get all changes working. Usually in Ubuntu, a logout/login is enough.

Pair the wiimote

Of course, if you didn’t pair your wiimote, pair it using the red sync button (the one in the batteries slot).

Read the manual

Seriously, the xf86-input-xwiimote manual is really nice. Give a try if you want different options:

man xf86-input-xwiimote

See all