Mailx: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 10: Line 10:


=Configuration=
=Configuration=
==Verbose and Debug Output==
In order to get verbose output, use the <tt>-v</tt> on mailx command line. This will send verbose output to stdout as the e-mail is being sent.
The <tt>debug</tt> option dumps the protocol headers, but it configures mailx to '''not''' send anything externally - no connection is attempted:
<pre>
...
set debug
...
</pre>


==Configuring mailx to Use a Google SMTP Server==
==Configuring mailx to Use a Google SMTP Server==

Revision as of 05:15, 17 March 2016

Internal

Installation

yum install mailx

Configuration

Verbose and Debug Output

In order to get verbose output, use the -v on mailx command line. This will send verbose output to stdout as the e-mail is being sent.

The debug option dumps the protocol headers, but it configures mailx to not send anything externally - no connection is attempted:

...
set debug
...

Configuring mailx to Use a Google SMTP Server

SMTP Relay Service

The relay server that requires TLS encryption is smtp-relay.gmail.com:587.

Individual Application SMTP Settings


TODO unfinished, not working.

First, you will need to make sure mailx has access to a valid Google certificate in an NSS certificate database. Firefox usually has it in its profile directory, but it is a good idea to initialize a private certificate database for mailx. This page explains how to do that Create a New NSS Certificate Database and Import Google's Certificate:

Assuming you provision root GMail SMTP access, move the certs directory created at the previous step under ~root as follows:

mv .../certs ~root/.certs

Configure /etc/mail.rc as follows:


...

account gmail {
set smtp-use-starttls
set smtp-auth=login
set smtp=smtps://smtp.gmail.com:587
set from="root@now510"
set smtp-auth-user=your.smtp.user@gmail.com
set smtp-auth-password=your.pass
set ssl-verify=ignore
set nss-config-dir=/root/.certs
}

TODO: try a per-user mail.rc that is read restricted because it contains sensitive credentials.

Test:

echo "mailx e-mail" | mailx -v -A gmail -s "test" somebody@example.com



Deplete:

Next:

  • Clarify mail on now510: be able to send mail and test how does cron reacts to it (success or failure). Document -> [1], understand the nss business.