LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   SendMail Not Sending, Messages Stuck In Queue As: Deferred: Connection (https://www.linuxquestions.org/questions/linux-software-2/sendmail-not-sending-messages-stuck-in-queue-as-deferred-connection-524708/)

wpn146 02-09-2007 04:06 PM

Removed. Somebody else already posted my suggestion...

isuck@linux 02-09-2007 08:05 PM

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.

recursio 03-06-2007 04:03 PM

what does cat /etc/mail/access display

need to add your public ip as a relay

JustinK101 03-07-2007 03:38 PM

Quote:

Originally Posted by recursio
what does cat /etc/mail/access display

need to add your public ip as a relay

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

Looks good to me, any other suggestions?

recursio 03-08-2007 03:40 PM

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

JustinK101 03-09-2007 01:24 PM

Quote:

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.

Quote:

cat /etc/sysconfig/network
BELVEDERE | root -=-> cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=BELVEDERE

Quote:

cat /etc/hosts
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

recursio 03-14-2007 06:47 PM

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:

127.0.0.1 localhost.localdomain localhost
X.X.X.X your_domain.com BELVEDERE

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.

JustinK101 03-15-2007 02:56 AM

Quote:

Substitute your static (public) IP address for x.x.x.x and change the /etc/hosts to reflect the following:

127.0.0.1 localhost.localdomain localhost
X.X.X.X your_domain.com BELVEDERE
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:

127.0.0.1 localhost.localdomain localhost
X.X.X.X your_domain.com BELVEDERE

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.

recursio 03-16-2007 12:07 AM

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

sendmail -v recursio@gmail.com <sendstuff

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.

/etc/init.d/sendmail stop

JustinK101 03-19-2007 12:23 PM

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)

[-- Attachment #2 --]
[-- Type: message/delivery-status, Encoding: 7bit, Size: 0.3K --]

Reporting-MTA: dns; localhost.localdomain
Received-From-MTA: DNS; localhost
Arrival-Date: Mon, 19 Mar 2007 10:19:27 -0700

recursio 03-20-2007 01:12 PM

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

sendmail -v -q -OQueueTimeout=20d

JustinK101 03-21-2007 11:31 AM

Contents /etc/resolv.conf file.

Quote:

nameserver 68.94.156.1
nameserver 68.94.157.1
nameserver 192.168.0.1
The top two ipaddresses are my ISP's dns servers, so that is already configured.

wpn146 03-29-2007 05:21 PM

I have seen at least three correct answers here. What you need is a one-line change in your /etc/mail/sendmail.mc file:
Code:

define(`SMART_HOST',`<YourSmtpProvider.com>')dnl
and follow the instructions given at the top of the file.

JustinK101 03-30-2007 12:21 AM

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!


All times are GMT -5. The time now is 10:47 PM.