SendMail Not Sending, Messages Stuck In Queue As: Deferred: Connection
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
As far as I know the smart host is in case you have a gateway, a computer fully connected and you need to redirect all the email to get out that way. That is the only case where you would use smart host. If this is the case and you need smart host, use the external interface instead of the loopback.
BELVEDERE | root -=-> cat /etc/mail/access
# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# by default we allow relaying from localhost...
localhost RELAY
127.0.0.1 RELAY
BELVEDERE RELAY
yes, it is relaying email to its self, localhost and 127.0.0.1 are both non-public names
not sure what the BELVEDERE is resolving to, im guessing that BELVEDERE is the name of your computer, if so then that name should be tied to a public IP address in the /etc/hosts file.
what do these commands display?
cat /etc/sysconfig/network
cat /etc/hosts
cat /etc/host.conf
yes, it is relaying email to its self, localhost and 127.0.0.1 are both non-public names.
Yeah that is what I want though, I only want local applications such as php, and apache to be able to send external mail.
Quote:
not sure what the BELVEDERE is resolving to, im guessing that BELVEDERE is the name of your computer, if so then that name should be tied to a public IP address in the /etc/hosts file.
Yes, BELEVEDE is the computer name, but I am nto running any DNS server such as bind. I wish to simply send email.
BELVEDERE | root -=-> cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 BELVEDERE localhost localhost.localdomain
Quote:
cat /etc/host.conf
BELVEDERE | root -=-> cat /etc/host.conf
order hosts,bind
Okay, BELVEDERE is set to relay. But BELVEDERE is pointing to the internal IP address, thus you are not able to relay messages to the outside world.
There seems to be a problem in the /etc/hosts file, there are four fields when there should only be three.
from "man hosts":
Quote:
For each host a single line should be present with the following information:
IP_address cononical_hostname aliases
It's important to remember that the /etc/hosts file is the first place your computer will look when doing foward and reverse DNS lookups, according to your /etc/host.config file.
Substitute your static (public) IP address for x.x.x.x and change the /etc/hosts to reflect the following:
or you could simply list your public IP address in the /etc/mail/access file as the following:
x.x.x.x RELAY
WARNING, once you do this, you will become a target for spammers, so you need to lock down your SMTP server. There are several ways to do that. Perhaps the best way to lock down you SMTP server is to always require authentication before a message is accepted for delivery. What this means is that each time a message is send to the SMTP server for external delivery, the SMTP server then required a valid user name and password before the message is accepted for delivery. However, the SMTP server is also aways listening on the SMTP port for incomming messages, these messages are intended to be delivered to your local users and no authentication is required, as these are messages are from users on other systems.
let me say that again:
Outgoing SMTP messages should require authentication before the message is accepted for delivery. Incomming SMTP messages should not require authentication before being accepted, but sendmail will check to see if the email account is valid on the local system.
Ok the problem is that, the static (public) IP changes, we are using a DSL connection in the office, and this server resides in the office. All the content served by Apache and the FTP server is only local, which is fine, but I need to be able to send email externally, for obvious reasons. So, locally in the office we simply type: http://192.168.0.200/myfolder/ for Apache/Web Server content, and the same idea for FTP, which works.
So, as a result I have no DNS (domain) configured, BIND is running, but not setup at all.
So, when you say:
What do I put in X.X.X.X if my ip changes. Also, what is the meaning of localhost.localdomain? Is that correct? That is probably enough questions for one post.
Thank you greatly for your assistance, I truely appreciate it greatly.
you can add a range of IP addresses with a single command in the /etc/mail/access file
198.168.0 RELAY
would allow 198.168.0.x to relay, where x is any decimal integer from 0 to 255 inclusive.
This will allow you to send email to your local network, but the question is how to configure sendmail to relay email on DHCP. If you know the possible range of IPs that you could be assigned, then you could add that to the /etc/mail/access file
28 RELAY
would allow 28.x.x.x to relay
Do you have router as a gateway to your dsl connection, and is it configured to DHCP? I would definitely include the 198.168.0.200 in the access relay list, although it may work without it, something to try ...
I would goto a site like http://whatismyipaddress.com/ and determine what you IP is now. Then do a whois lookup to find out the range of ips that your carrier owns, or you might call then and ask for the range that you could be assigned. On a linux box, goto the command line and type whois followed by the ip address and then hit enter, it gives way better results than from most web pages that I've seen.
Once you have your access file setup with the local and external ranges, create a text file in your /root directory called sendstuff and while logged in as root type the following to test your sendmail, first start your sendmail service
/etc/init.d/sendmail start
then type this to send an email from the command line
the -v is for verbose mode, and will show you the transcript of the message as it is sent, and any error messages that you might be getting.
then don't forget to stop your sendmail service, you need to seriously figure out how to require authentication first before you let it run for hours unattended, otherwise spammers will eventually take advantage of your smtp server ... Your IP will likely stay the same, when it's lease is up the typically reassign the same IP. Your IP will most likely change to a new IP if you reset your DSL connection by cycling the power on your DSL modem.
Thanks for the help, but still getting the email bounced back to the server. Do you have to have DNS setup on a server to be able to send email? Cant you just send email from an IP address? Also, its interesting that is says the name server is 127.0.0.1, is this normal? Shouldnt it have my ISP's DNS server there, so it can route? Thanks for the help, once again.
The original message was received at Mon, 19 Mar 2007 10:19:27 -0700
from localhost [127.0.0.1]
----- The following addresses had permanent fatal errors -----
<jkeller@myrealdomaingoeshere.com>
(reason: 550 Host unknown)
----- Transcript of session follows -----
550 5.1.2 <jkeller@myrealdomaingoeshere.com>... Host unknown (Name server: 127.0.0.1: host not found)
Setting up DNS on the server is not required to send email. If all of the lookups are in the hosts file, then DNS is not needed.
When a DNS lookup is required, the /etc/host.conf file shows where to look and the order of DNS searches.
order hosts,bind
hosts is simply the /etc/hosts file.
bind is the name server, if your are running DNS then it looks to your server, else it goes to the name server located in the /etc/resolv.conf file.
change the line in /etc/resolv.conf
nameserver 127.0.0.1
to point the name server's IP provided by your IPS.
also when running your mailq, the messages are stuck in the mailq and will be deleted after four days.
to run the mailq from the command line and keep for twenty days
Yeah the smart host was close to the fix, also had to add the SMTP Authen information into a new file, I followed a guide on the internet which walked me through the entire thing. Thanks guys!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.