Solved

Sendmail or mailx sending to external SMTP server

Posted on 2013-06-07
5
627 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
Comment Utility
PS, this is rPath.  mail, mailx and sendmail are on the box.  I also installed mutt to no avail
0
 
LVL 76

Accepted Solution

by:
arnold earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now