Link to home
Start Free TrialLog in
Avatar of jakoji
jakoji

asked on

How to configure mail client on RHEL5

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
Avatar of fosiul01
fosiul01
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of David Beveridge
GMAIL might be checking that the sender address is valid?
Does your server hostname have an MX or A record in the DNS?
Avatar of jakoji
jakoji

ASKER

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
 
 
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.

Avatar of jakoji

ASKER

:-(......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
Avatar of jakoji

ASKER

nd one more thing how to use smart host option?
ASKER CERTIFIED SOLUTION
Avatar of fosiul01
fosiul01
Flag of United Kingdom of Great Britain and Northern Ireland 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
Avatar of jakoji

ASKER

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.
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
Avatar of jakoji

ASKER

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!!!#%^&&
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 ...
Avatar of jakoji

ASKER

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
Avatar of jakoji

ASKER

i meant *i didnt get it at all
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 ..



Avatar of jakoji

ASKER

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


will you be able to give me the IP
it would be easy to check
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
Avatar of jakoji

ASKER

hi sorry for delay ...this is my current ip 59.164.8.114
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
Avatar of jakoji

ASKER

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
                                    

speak with the provider , tell them their ip is black listed, .... nothing you can do about it.
Avatar of jakoji

ASKER

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 :-)
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!!!
Avatar of jakoji

ASKER

yeah exactly....so how are u man ...gave DBA Exam or not? or RHCE exam
$_$ $_$
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
Avatar of jakoji

ASKER

ok keep it(hardwork) up

Goodbye
thanks