Link to home
Start Free TrialLog in
Avatar of softbless
softbless

asked on

Send email through linux console

Hi All,

I have a log file that need to be sent to an email address.

I've tried this script :

echo "This is mail body" | mail -s "This is subject" mymail@mydomain.com

It give me nothing.

Could you provide step by step to configure my linux server so I could send email, and also provide me the script.

A link to other forum would  be fine, if it give clear and detailed information
ASKER CERTIFIED SOLUTION
Avatar of Deepak Sharma
Deepak Sharma
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You should first have a look at the maillog to see what happened. There are numerous reasons for the failure of a mail.
The logs you'll find under /var/log.


SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In my testing and quick learning curve with it, I was able to emails with attachments.
if you are asking this not for any programming use.. then i would suggest you check out pine
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of softbless
softbless

ASKER

Hi Guys,

Please response :
@savone, I've tried :
cat - config.txt << EOF | sendmail -t
to:email1@yahoo.com
from:email2@gmail.com
subject:Log File
EOF
It doesn't give error message when I execute it, but I don't receive the email

The same thing goes to commands that was given by @ajay

@hemmi, i cannot understand the log.

I'll attach the mailloh in this post.

@c_a_n_o_n I've tried installing the sendEmail, but I got error message. If I use this commad :
sendEmail -f mygmail.email@gmail.com -t myyahooemail@yahoo.com \
-u this is the test tile -m “this is a test message” \
-s smtp.gmail.com \
-o tls=auto \
-xu mygmail.email -xp mygmailpassword
The error message will be :
Apr 07 08:34:45 localhost sendEmail[5476]: NOTICE => Authentication not supported by the remote SMTP server!
Apr 07 08:34:46 localhost sendEmail[5476]: ERROR => Received:       530 5.7.0 Must issue a STARTTLS command first. v26sm7259924qce.13

and If I use this command :
sendEmail -f mygmail.email@gmail.com -t myyahooemail@yahoo.com \
-u this is the test tile -m “this is a test message” \
-s smtp.gmail.com \
-o tls=yes \
-xu mygmail.email -xp mygmailpassword

the error message will be :
Apr 07 08:38:40 localhost sendEmail[5601]: ERROR => No TLS support!  SendEmail can't load required libraries. (try installing Net::SSLeay and IO::Socket::SSL)

Please kindly response... thank you.
maillog
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sending email to Yahoo can be difficult.  They block a lot of things.  The fact that your From address isn't going to match your server address may make it harder also.  Do you have other email addresses that you can use?  For test purposes, it would be nice if they Didn't have spam blocking.

I think I would first get a standard email program working on your server to make sure that works.
@testez, could you give command to install the Net::SSLeay and IO::Socket::SSL perl modules?