Solved

How to configure mail client on RHEL5

Posted on 2009-05-07
27
1,014 Views
Last Modified: 2012-06-27
Hi,

I want to use mail via command line in an script and mail the output to gmail.com  account

bit like this

#!/bin/bash
#will send mail to root and user lala
for NAME in root lala
do
ADDRESS="$NAME@example.com"
MESSAGE="Scripting is cool"
echo $MESSAGE | mail -s "mast" $ADDRESS
done

this works fine on my local postfix mail server but i want to run it on an diffrent pc and the change here is gmail.com  but it doesnt sends any mail to my gmail.com account may be due to MTA issue i dont know about it...
Pls tell me steps to achive it

Thanks for helping
0
Comment
Question by:jakoji
  • 13
  • 12
  • 2
27 Comments
 
LVL 29

Expert Comment

by:fosiul01
ID: 24333729
Hi, i never worked on postfix .

but few things i will have to tell you to check

1. is your port 25 is open by firewall ?? can you telnet port 25  from outside of your network ??

2. do you have static Ip ??

3. do you have reverse dns setup for your domain ??

also, can you past some error from maillog when you are trying to sent email to gmail
0
 
LVL 19

Expert Comment

by:bevhost
ID: 24333794
GMAIL might be checking that the sender address is valid?
Does your server hostname have an MX or A record in the DNS?
0
 
LVL 1

Author Comment

by:jakoji
ID: 24333961
Ty for reply experts,
@fosiul
actually iam not making my mail server to talk to internet all what i want is i have an standalone machine(not part of my network) having internet connected(via DHCP ip) nd iam wanting my sript to send mails using mail command like above script
25,80,8080,443,993,995 110,135 ports are open on this machine i think its more than enough ;-)
its an RHEL5 system
 
 
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24333979
yes, it enough!!

your comments

"having internet connected(via DHCP ip)"

I am gussing you dont have any static ip from isp ,if it yes then

you would not able to sent any email to gmail, yahoo or hotmail whatever, even if you sent email to my mailserver it will reject

why ?? because those mail server will not accept any email comming from dhcp Ip.

what the solution : you will have to use smart host option to send email via your Isp mailserver.

0
 
LVL 1

Author Comment

by:jakoji
ID: 24334017
:-(......k bro but thing is we are all behind NAT and right now iam routed via this static ip
59.164.8.56.man-static.vsnl.net.in
 though the route changes usually like somtimes i get 59.163.8.14 from ip checking sites  may be due to OSPF routing.
 may i sense some hope ;-D ?
and we get ips with private address range of 10.188.200.0/24
0
 
LVL 1

Author Comment

by:jakoji
ID: 24334028
nd one more thing how to use smart host option?
0
 
LVL 29

Accepted Solution

by:
fosiul01 earned 100 total points
ID: 24334052
i need to find out how to use smart host in postfix

read this how to use smart host

http://ubuntu.wordpress.com/2005/09/07/setting-a-smarthost-in-postfix/

let me refresh again

the Ip you  put in your modem or router whatever (which is connect to your isp) you have static ip is not it ??

suppose if you go to this site,

whatismyip

it will show you what is your ip,  suppose its 59.163.8.14 , is isp defined that Ip to you ??

0
 
LVL 1

Author Comment

by:jakoji
ID: 24334140
Its an WIMAX Broadband connection where all users are behind NAT and we get ips from  private addresses from isp then when i  open the internet browser i get the login page within the browser where i have to login then i access the internet
10.188.200.15(ip i got from isp)>>>10.188.200.1(Gate way ip/ISP router may be)>>>login process in my browser(if  success) >>>internet
on my pc i have lan card its cable is attached to an WIMAX Dish on my house roof thats all i have no modem no router actually the dish works all the job.
We are behind 2,3 NATTED public ips subnets and they are definatly statice ips :-)
what shold i put in relayhost = ?
shold i put the dns server ip which 172.24.254.2(its also private ip) or mail.gmail.com
 have u mailed from commandline to internet mail server like yahoo before? if yes pls give the set-up i"ll implement it as you guide me.
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24334156
what shold i put in relayhost = ?   the mail server address of yoru isp

it could be mail.yourisp.com

ask your isp

if you get 10.188.200.15, in that case you dont have static ip i guess, and in that case you will have to use isp mailserver
0
 
LVL 1

Author Comment

by:jakoji
ID: 24334240
Actually i put the dns server of my isp and now its working but they are all are going into spam i wonder whats wrong with gmail!!!#%^&&
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24334248
LoL at least  gmail is accpeting!!!!

check the ip of yoru Isp, if that one has rever dns setup or if that one is not blocked any time before

gmail is too fussy and hotmail aswell ...
0
 
LVL 1

Author Comment

by:jakoji
ID: 24334399
but after getting just one mail its not accepting any mails not even in spam folder :-( the ip its showing is not my dns server ip but its my public ip
and i sent to yahoo"s account too but it didnt accept it at all....i wonder how yahoo accept accept almost 10-15 spam mails that i get in my mailbox for enlarging an Pecker HaHa..... see how much yhoo cares for those things but not if i uses an legimate ip  Fcuking stupidty...from these internet"s biggest mail serves LoL
0
 
LVL 1

Author Comment

by:jakoji
ID: 24334406
i meant *i didnt get it at all
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 29

Expert Comment

by:fosiul01
ID: 24334436
check the proper mailserver address of your isp.

then use the mailserver .

about your this commnets :.i wonder how yahoo accept accept almost 10-15 spam mails that i get in my mailbox for enlarging an Pecker

its because, yahoo getting those smap from legitmate IP!!! yes,

example, when i build my mailserver, it been hacked and spammer was using this one to sent spam, since my IP is static with allthe reverse dns and other setup, yahoo or other mail server will recieved those spam email!!

the consequences is, next day my ip was blocked as spam!!


your comments:the ip its showing is not my dns server ip but its my public ip

find out, what ip of the mailserver of yoru ISp use that one ..
if that does not work then there is some issue with ip and your isp ..



0
 
LVL 1

Author Comment

by:jakoji
ID: 24334480
When i dig my isps dns server like this dig 172.24.254.2 MX i get this in reply section

;; AUTHORITY SECTION:
.                       10800   IN      SOA     A.ROOT-SERVERS.NET. NSTLD.VERISIGN-GRS.COM. 2009050800 1800 900 604800 86400


0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24334502
will you be able to give me the IP
it would be easy to check
0
 
LVL 19

Expert Comment

by:bevhost
ID: 24334525
You can do mail server checks here
http://tools.bevhost.com/spf

Just type in the Ip address of the server and it will check it for you
0
 
LVL 1

Author Comment

by:jakoji
ID: 24336073
hi sorry for delay ...this is my current ip 59.164.8.114
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24336129
LOL!!!

this ip is listed as spam

BARRACUDA       LISTED (127.0.0.2)       TXT= "http://www.barracudanetworks.com/reputation/?pr=1&ip=59.164.8.114       900 seconds       125 ms

CBL       LISTED (127.0.0.2)       TXT= "Blocked - see http://cbl.abuseat.org/lookup.cgi?ip=59.164.8.114       3600 seconds       125 ms


http://www.spamhaus.org/query/bl?ip=59.164.8.114
0
 
LVL 1

Author Comment

by:jakoji
ID: 24336274
spamhaus list sucks in bigtime an this just an another example  of that these foolish people doesnt know how many people behind an NATTED subnet these guys think they own internet bloddy *%#@^
see the silly notice

Important: If you are using any normal email softwaresuch as Outlook, Entourage, Thunderbird, Apple Mail, and you are beingblocked by this Spamhaus PBL listing when you try to send email, thereason is simply that you need to turn on "SMTP Authentication"in your email software settings (Tools : Accounts : Properties :Outgoing Mail Server : check "My server requires authentication").
If you do not know how to do this, ask your Internet Service Provider for help with "SMTP Authentication".



i wonder wher i do his in mutt  .....LOL
                                    

0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24336300
speak with the provider , tell them their ip is black listed, .... nothing you can do about it.
0
 
LVL 1

Author Comment

by:jakoji
ID: 24336388
Yeah..man ther are many things we cant do NOTHING no freedom ...nd as far as matter of telling to isp if i talk to them about this stuff those brain-eater call centre guys will be give me headache.

At least i saw one message at my mail box though it was first and last but that gave me lil pleasure :-)
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24336412
ahahaha

LOl
yes, when i used to live in Bangladesh, then when i used to talk with Isp about the problem , they act as big-headed!!!
this is the problem of people in bangladesh, pakistan and india, if any one work in isp, they think they know too much

but true is, if you ask them some basic thing they will be stuck!!!
0
 
LVL 1

Author Comment

by:jakoji
ID: 24336481
yeah exactly....so how are u man ...gave DBA Exam or not? or RHCE exam
$_$ $_$
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24336524
no yet!!

still stuyding, will give the DBA exam soon, waiting to get a response from a employer, had and intevew last weak, if i get that job, then seriously have to think of DBA

but eitherway will sit for that exam soon

about RHCE, i am thinking of giving that one from last cople of month, but catn concentrate properly
0
 
LVL 1

Author Comment

by:jakoji
ID: 24336560
ok keep it(hardwork) up

Goodbye
0
 
LVL 29

Expert Comment

by:fosiul01
ID: 24336575
thanks
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
#Citrix #POC #XenDesktop #vCenter #VMware #ESX
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

747 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

17 Experts available now in Live!

Get 1:1 Help Now