Mailx: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(20 intermediate revisions by the same user not shown)
Line 11: Line 11:
=Configuration=
=Configuration=


==Configuring mailx to Use a Google SMTP Server==
==Verbose and Debug Output==


First, you will need to make sure <tt>mailx</tt> 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 <tt>mailx</tt>. This page explains how to do that [[NSS#Create_a_New_Certificate_Database_and_Import_Google.27s_Certificate|Create a New NSS Certificate Database and Import Google's Certificate]]:
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:


Deplete:
<pre>
* http://www.systutorials.com/1411/sending-email-from-mailx-command-in-linux-using-gmails-smtp/
...
* http://stackoverflow.com/questions/16799407/mailx-and-gmail-nss-config-dir
set debug
* http://serverfault.com/questions/498588/smtp-gmail-com-from-bash-gives-error-in-certificate-peers-certificate-issuer
...
* http://www.systutorials.com/1411/sending-email-from-mailx-command-in-linux-using-gmails-smtp/
</pre>


==Configuring mailx to Relay via a Google SMTP Server==


Last:
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[Configure mailx to Relay via a Google SMTP Server]]
</blockquote>


SSL/TLS handshake failed: Unknown error -5938.
=Using from Command Line=


 
<pre>
http://stackoverflow.com/questions/16799407/mailx-and-gmail-nss-config-dir
echo "test" | mailx -A gmail -s "test" test@example.com
 
</pre>
 
continue to https://kb.novaordis.com/index.php/mail#Configuration
 
Clarify mail on now510: be able to send mail and test how does cron reacts to it (success or failure). Document -> [http://www.systutorials.com/1411/sending-email-from-mailx-command-in-linux-using-gmails-smtp/], understand the nss business.
 
 
 
Document NSS
• http://serverfault.com/questions/498588/smtp-gmail-com-from-bash-gives-error-in-certificate-peers-certificate-issuer
 
 
Try to use the /etc/pki/nssdb
 
 
IMPORTANT! My google password is in /etc/mail.rc
 
Tried:
 
echo "test" | mailx -v -A gmail -s "command line e-mail" ovidiu@feodorov.com

Latest revision as of 07:41, 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 Relay via a Google SMTP Server

Configure mailx to Relay via a Google SMTP Server

Using from Command Line

echo "test" | mailx -A gmail -s "test" test@example.com