Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1072
  • Last Modified:

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
0
jakoji
Asked:
jakoji
  • 13
  • 12
  • 2
1 Solution
 
fosiul01Commented:
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
 
bevhostCommented:
GMAIL might be checking that the sender address is valid?
Does your server hostname have an MX or A record in the DNS?
0
 
jakojiAuthor Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
fosiul01Commented:
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
 
jakojiAuthor Commented:
:-(......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
 
jakojiAuthor Commented:
nd one more thing how to use smart host option?
0
 
fosiul01Commented:
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
 
jakojiAuthor Commented:
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
 
fosiul01Commented:
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
 
jakojiAuthor Commented:
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
 
fosiul01Commented:
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
 
jakojiAuthor Commented:
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
 
jakojiAuthor Commented:
i meant *i didnt get it at all
0
 
fosiul01Commented:
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
 
jakojiAuthor Commented:
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
 
fosiul01Commented:
will you be able to give me the IP
it would be easy to check
0
 
bevhostCommented:
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
 
jakojiAuthor Commented:
hi sorry for delay ...this is my current ip 59.164.8.114
0
 
fosiul01Commented:
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
 
jakojiAuthor Commented:
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
 
fosiul01Commented:
speak with the provider , tell them their ip is black listed, .... nothing you can do about it.
0
 
jakojiAuthor Commented:
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
 
fosiul01Commented:
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
 
jakojiAuthor Commented:
yeah exactly....so how are u man ...gave DBA Exam or not? or RHCE exam
$_$ $_$
0
 
fosiul01Commented:
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
 
jakojiAuthor Commented:
ok keep it(hardwork) up

Goodbye
0
 
fosiul01Commented:
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 13
  • 12
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now