Solved

sendmail from localhost

Posted on 2010-11-24
32
1,646 Views
Last Modified: 2013-12-16
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
Comment
Question by:Insoftservice
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 16
  • 9
  • 2
  • +1
32 Comments
 
LVL 7

Accepted Solution

by:
stephenhoekstra earned 400 total points
ID: 34216551
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
 
LVL 10

Expert Comment

by:srgilani
ID: 34216656
want to use sendmail with your centos ?
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 34216706
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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 15

Author Comment

by:Insoftservice
ID: 34216867
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
 
LVL 7

Assisted Solution

by:stephenhoekstra
stephenhoekstra earned 400 total points
ID: 34217230
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
 
LVL 15

Author Comment

by:Insoftservice
ID: 34219054
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
 
LVL 10

Assisted Solution

by:srgilani
srgilani earned 100 total points
ID: 34220791
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
 
LVL 15

Author Comment

by:Insoftservice
ID: 34221029
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
 
LVL 7

Expert Comment

by:stephenhoekstra
ID: 34221776
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
 
LVL 6

Expert Comment

by:M. Rashel Ahmed
ID: 34224018
hello,

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


0
 
LVL 15

Author Comment

by:Insoftservice
ID: 34230595
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
 
LVL 7

Expert Comment

by:stephenhoekstra
ID: 34231058
What does the log file say?
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 34236074
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
 
LVL 7

Assisted Solution

by:stephenhoekstra
stephenhoekstra earned 400 total points
ID: 34245294
netstat -anp |grep ":25"

paste the output here.  Something is running on port 25 already which is preventing Exim from starting up.
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 34249626
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
 
LVL 15

Author Comment

by:Insoftservice
ID: 34249818
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
 
LVL 7

Expert Comment

by:stephenhoekstra
ID: 34249892
And if you try send mail now via Exim with the same commands, what does the log say?
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 34249944
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
 
LVL 7

Expert Comment

by:stephenhoekstra
ID: 34249983
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
 
LVL 15

Author Comment

by:Insoftservice
ID: 34250076
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
 
LVL 7

Assisted Solution

by:stephenhoekstra
stephenhoekstra earned 400 total points
ID: 34250465
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
 
LVL 15

Author Comment

by:Insoftservice
ID: 34250793
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
 
LVL 7

Expert Comment

by:stephenhoekstra
ID: 34250836
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
 
LVL 15

Author Comment

by:Insoftservice
ID: 34251026
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
 
LVL 15

Author Comment

by:Insoftservice
ID: 34328150
hi stephenhoekstra,

was there some mistake from my side i did it again but same got the same 2 files
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 34532060
HI,
Still no replies for the comments
0
 
LVL 15

Author Comment

by:Insoftservice
ID: 34830915

They tried but the points were not up to mark to fll fill my requiremnts
0
 
LVL 15

Author Closing Comment

by:Insoftservice
ID: 34830928
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Fine Tune your automatic Updates for Ubuntu / Debian
Pop culture is prime bait for hackers seeking to infect user’s computers and mobile devices with malicious malware. Hackers know exactly what the latest trends are online and know how to use them to their advantage.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…

740 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