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: 1685
  • Last Modified:

sendmail from localhost

Hi,

I want to do send emails from my localhost .

I have bought my own domain i.e www.managalsutrabandhan.com.
So,
i think so my dns provider i.e godaddy  might have provided me smtp.
so how to use it.

server: centos 5

0
Insoftservice
Asked:
Insoftservice
  • 16
  • 9
  • 2
  • +1
5 Solutions
 
stephenhoekstraCommented:
You should configure an MTA such as Exim or Postfix (sendmail is a pain imo) in order to send and receive email to your server.

Both of the below links will help you setup Exim with IMAP/POP support and a webmail client on a CentOS server and are fairly straight forward.  Both include ClamAV and SpamAssassin

http://www.howtoforge.com/exim-mysql-cyrus-imapd-horde-centos5.1
http://www.eazynet.de/running_a_centos_server_with_lighttpd_php_mySQL_exim_with_virtual_users_dovecot_and_squirrelmail

0
 
srgilaniCommented:
want to use sendmail with your centos ?
0
 
InsoftserviceAuthor Commented:
hi
yes,
I want to use mailing system on my local m/c @server where  i will host my webiste.
http://www.experts-exchange.com/OS/Linux/Q_26304019.html
But this did not worked as expected,
So,Currently i would try to send the mail by using default sendmail of linux and using php.
So, i need the setup process.
But even if some one has the sendmail steps too i can assign one more new question for it if required.
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.

 
InsoftserviceAuthor Commented:
HI @stephenhoekstra:

Thanx for ur comment .
I would try it on my other server.since,
now i will not try to do rnd on my hosting server so,
currently do u have any idea how to send emails via local host.
ie. by just editing php.ini
0
 
stephenhoekstraCommented:
I doubt GoDaddy will supply you with an SMTP server to relay through, although I may be wrong.  In either case you would need to configure your local SMTP to either relay via a 3rd party or send directly.

The easiest way to acheive this would be:

# yum install exim
# service exim start
add/update the line HOSTNAME="managalsutrabandhan.com" to /etc/sysconfig/network.
# hostname managalsutrabandhan.com
# sendmail <email address with a different domain>
test message from managalsutrabandhan.com
.

# tail /var/log/exim/main.log

you should see an entry similar to this one which I sent as a test:

2010-11-26 11:48:54 1PLwnK-00073q-7o <= root@****.com U=root P=local S=316
2010-11-26 11:48:55 1PLwnK-00073q-7o => ****@gmail.com R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [74.125.95.27]
2010-11-26 11:48:55 1PLwnK-00073q-7o Completed


I checked my gmail and the mail was there.

If you see a message such as this one:
root@****.com R=localuser T=local_delivery defer (-29): User 0 set for local_delivery transport is on the never_users list

Edit /etc/exim/exim.conf and search for never_users, hash at that line, then
# service exim restart.

To make exim start on boot,
# chkconfig exim on.  
As you can see, this is configured quite quickly.  When you've completed this, you should be able to mail via PHP as by default php.ini has sendmail enabled.  I've not sure on the PHP code needed as I don't use PHP, but http://php.net/manual/en/function.mail.php seems like a good place to start.

0
 
InsoftserviceAuthor Commented:
Hi @stephenhoekstra:
Thanx for ur comment
May i know how to check whether smtp has been assigned to my dns
like how we check dns owner by whois.
my othe dns provider has provided me the smtp but i am not sure how to check whether its working or not
0
 
srgilaniCommented:
you can check your preference in your godaddy account.

i have check so far there is no MX record and A record setting for your above mentioned domain.

you can check DNS stuff on below site.

http://www.zoneedit.com/lookup.html
0
 
InsoftserviceAuthor Commented:
Hi,
i have got the mx record how to use it any idea.
today i am trying the above 2 steps of othe EE. on my vmware. so that which ever works i will implment it on my live server
0
 
stephenhoekstraCommented:
The MX record in your zone sets where mail sent to that domain should be delivered to.  So if you mailserver is 10.20.30.40, that would be your MX record.
0
 
M. Rashel AhmedCommented:
hello,

you need to make sure that the send mail path is ' /usr/sbin/sendmail'


0
 
InsoftserviceAuthor Commented:
Hi,
@stephenhoekstra i tried ur second method of gmail.
It got stuck after using mangalsutrabandhan.com .
but when i used gmail.com .
it again went bash prompt but still did not received any mail
what i did for gmail

sendmail <--|
abc@yahoo.com<--|
test message from gmail.com<--|
. <--|
was my some mistake.

0
 
stephenhoekstraCommented:
What does the log file say?
0
 
InsoftserviceAuthor Commented:
Hi,
this one was my log when i tried with mangalsutrabandhan.com but when i tried with gmail there was no log.
2010-11-29 00:53:24 socket bind() to port 25 for address 127.0.0.1 failed: Address already in use: waiting 30s before trying again (4 more tries)
2010-11-29 00:53:54 socket bind() to port 25 for address 127.0.0.1 failed: Address already in use: waiting 30s before trying again (3 more tries)
2010-11-29 00:54:24 socket bind() to port 25 for address 127.0.0.1 failed: Address already in use: waiting 30s before trying again (2 more tries)
2010-11-29 00:54:54 socket bind() to port 25 for address 127.0.0.1 failed: Address already in use: waiting 30s before trying again (1 more try)
2010-11-29 00:55:24 socket bind() to port 25 for address 127.0.0.1 failed: Address already in use: daemon abandoned
0
 
stephenhoekstraCommented:
netstat -anp |grep ":25"

paste the output here.  Something is running on port 25 already which is preventing Exim from starting up.
0
 
InsoftserviceAuthor Commented:
result

#] netstat -anp |grep ":25"
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      8224/sendmail: acce
tcp        0      1 127.0.0.1:34952             127.0.0.1:25                SYN_SENT    8233/oATIkpH8008314
0
 
InsoftserviceAuthor Commented:
Result after stopping sendmail & restart exim

ss already in use: waiting 30s before trying again (1 more try)
2010-12-01 01:14:01 socket bind() to port 25 for address 127.0.0.1 failed: Address already in use: daemon abandoned
2010-12-01 12:49:49 exim 4.63 daemon started: pid=9277, -q1h, listening for SMTP on [127.0.0.1]:25 [127.0.0.1]:587 [::1]:25 [::1]:587 and for SMTPS on [127.0.0.1]:465 [::1]:465
2010-12-01 12:49:49 Start queue run: pid=9279
2010-12-01 12:49:49 End queue run: pid=9279
0
 
stephenhoekstraCommented:
And if you try send mail now via Exim with the same commands, what does the log say?
0
 
InsoftserviceAuthor Commented:
Hi stephenhoekstra,
In my last comment i have mention the log report
when i had stopped send mail and started exim and now i used gmail.com
0
 
stephenhoekstraCommented:
Sorry but I don't understand your last post.

If you have done 'sendmail <email address here>' typed a message and put a . on it's own line, you should've seen similar lines in your /var/log/exim/main.log as the => and <= lines I pasted to show the incoming mail from localhost (the <= line) to the MTA, and then the outgoing delivery to the recipient address (the => line), and then a 'complete' line to show the delivery has finished.

The log you pasted just shows that Exim has started.
0
 
InsoftserviceAuthor Commented:
hi,
srry but i got the same o/p on my log file.
it has no report when i did the steps which i had mentioned earlier.
should i try whole command in same line.
0
 
stephenhoekstraCommented:
Once exim is running on port 25 (as you've shown it is), you should run 'tail -f /var/log/exim/main.log' in one terminal, and in another try to mail an email address you have access to, similar to how I tested mine:

# sendmail <email address with a different domain>
test message from managalsutrabandhan.com
.


You should see in your /var/log/exim/main.log lines similar to:
2010-11-26 11:48:54 1PLwnK-00073q-7o <= root@****.com U=root P=local S=316
2010-11-26 11:48:55 1PLwnK-00073q-7o => ****@gmail.com R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [74.125.95.27]
2010-11-26 11:48:55 1PLwnK-00073q-7o Completed


The first line shows the incoming mail from the sender (you) to Exim, second line shows the outgoing mail (to the recipient) from Exim and third line should say it's completed the delivery or give an error message.

0
 
InsoftserviceAuthor Commented:
hi,
no o/p when i did it on other terminal do i have to do any changes in php.ini.

pls note i have not tried ur very first comment.
do i have to do tht too.
is there any problem due to  iptable
0
 
stephenhoekstraCommented:
the first comment was if you wanted to setup a mailserverer on your centos server, and also gave instructions on how to setup webmail and antivirus/antispam.

there should be an output?  as long as the exim server is running (which you check with 'netstat -anp') you should get some form of output in the main.log file.  perhaps look in /var/log/exim/error.log and see if there are any errors?

additionally, you can telnet to the server and send a mail.  give http://www.yuki-onna.co.uk/email/smtp.html a read, it has a step by step guide to sending a mail using telnet.  the first line would be 'telnet localhost 25' and then follow the rest of the steps.

if it fails, please paste the output.
0
 
InsoftserviceAuthor Commented:
Hi,
i found only two file
main.log and panic.log.
so,
was the problem occurred since i did not did the steps of ur comment1.
tomorrow i will try to get the o/p of both telnet and smtp by the link given by u
0
 
InsoftserviceAuthor Commented:
hi stephenhoekstra,

was there some mistake from my side i did it again but same got the same 2 files
0
 
InsoftserviceAuthor Commented:
HI,
Still no replies for the comments
0
 
InsoftserviceAuthor Commented:

They tried but the points were not up to mark to fll fill my requiremnts
0
 
InsoftserviceAuthor Commented:
Its k they helped me a lot to resolve my issue but it was my luck tht it did not worked as i expected.
Thx to all
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 16
  • 9
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now