Solved

Sendmail or mailx sending to external SMTP server

Posted on 2013-06-07
5
635 Views
Last Modified: 2013-06-14
I just realized in my wealth (LOL) of linux knowledge, I have never set up an email client.  I have a script that needs to send a log file.  I use a program on windows called blat, which is simple and light.  When you install blat, you point to an SMTP server (open relay) and assign an email address....  Easy as pie.  

Without linking (I've read about 300 pages of trash), can anyone please provide a simple step by step to send email from the command line/shell without blowing my mind setting up MTA's and postfix....  I literally just need to send a log file to my email account from the linux machine on the same physical network and my patience are wearing thin...
0
Comment
Question by:choward16980
5 Comments
 
LVL 16

Author Comment

by:choward16980
ID: 39229768
PS, this is rPath.  mail, mailx and sendmail are on the box.  I also installed mutt to no avail
0
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 39229844
Sendmail is the component that delivers emails.
You do not need a mail client for script

(echo "To: emailaddress
From: sender address
Subject: test

This is a test";
cat logfile;

) | /usr/lib/sendmail -oi -t

Look at /var/log/maillog for information on what happened to the email.
0
 
LVL 26

Expert Comment

by:skullnobrains
ID: 39231150
using default settings, the MTA should already be setup for sending email in any linux distribution so you sould be able to simply use the "mail" command in order to drop your mail in maildrop and let the MTA pick it.

if your mta is a no-go, you can find plenty of equivalents to blat. smtpclient is one i remember using successfully, but there are others

it is not too complicated either to code a simple shell script using netcat

both the latter are a less good solution than using the MTA because if the remote server is down at the time your report is supposed to be sent, it will be lost. same with blat.
0
 
LVL 13

Expert Comment

by:Sandy
ID: 39234708
on windows you can even use sendmail client. please find below link


http://www.indigostar.com/smuman.html

Cheers,
sA
0
 
LVL 16

Author Closing Comment

by:choward16980
ID: 39236192
The issue was there was no host record for the smtp server.  I set up the domain I was trying to send to and pointed it toward the SMTP relay and everything came through as expected.  Thanks!

PS. the host record is /etc/hosts

hosts is the file
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linux Mint 18 31 89
video edge NVR Device Discovery Problem 4 45
how to configure linux OS using Ubuntu 7 37
How to mount nfs share on this CentOS server? 6 24
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question