Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sendmail can't email with same local domain

Status
Not open for further replies.

compquackers

Technical User
Feb 1, 2003
20
I have started this new thread as the problem is more simple now!

Redhat 9.0
sendmail 8.12.8-9.90

I have managed to get external emails sent with a membership php program using sendmail, but have a problem with any emails in my domain (even though i receive all my emails for this in another pc using outlook express on win98). What appears to happen is any email with my domain is trying to email internally - although the server is not setup to receive emails. They do not arrive and User unknown is error message again.

How can I allow emails to be sent outside the localhost using sendmail - it must be something very simple left to do now??? It's ironic as i had previously had no problems with them getting internally, just externally! I don't use the sendmail on my server to receive emails as it is simply used to send confirmation emails to clients, and also to tell me they have become a member. Client's get their mails, I don't!

Thanks for any advice.
 
open sendmail.mc and look for this line:

DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

This line is telling sendmail to only look for mail on the loopback device. Send mail will not look at eth0 with this line so you need to comment it out or delete it all together. If you make any changes to sendmail.mc, you'll need to build a new sendmail.cf. To do that, issue this command:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

You will need to change the paths to whatever they are on your system. Another thing to check is the /etc/mail/local-host-names file and make sure all domains hosted on this server are listed. You will also need to make sure that you have relaying enabled for your domain in /etc/mail/access. Add a line that looks like this:

mydomain.com RELAY

Add all domains you host here then issue the following command:

makemap hash /etc/mail/access.db < /etc/mail/access

This will alow relaying from you local machine but if you need to allow users to pass e-mail through your server from home, you will need to configure sendmail to allow relaying to the outside world. This is very easy to do but you will need to learn about securing your mail server before doing this or it won't take long for spammers to find your server and start sending mass amounts of spam through it. Without knowing how to secure your server you would have an open relay. If you get reported as an open relay spam blockers will have you in their list and you will find that a lot of mail servers will not allow mail from your server. Let me know if you need this feature.
 
Thanks RhythmAce

Ok I put a dnl # in front of the DAEMON_OPTIONS line:

dnl # DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

and ran m4

I went to the local host names file and added my server ip address on a line and also my web server on the next. One question is do i put or just abc.co.uk?

Also did the same for ip address & server domain on access file with relay command, and ran hash.

However my php based membership program still cannot send my home (i.e. non-server)pc an email on my domain. Here is the log (i have used abc@def.co.uk for security and the server name is xyz)

May 6 17:36:43 xyz sendmail[7016]: i46Lah83007016: from=apache, size=452, class=0, nrcpts=1, msgid=<200405062136.i46Lah83007016@def.co.uk>, relay=apache@localhost
May 6 17:36:43 xyz sendmail[7018]: i46LahVJ007018: <abc@def.co.uk>... User unknown
May 6 17:36:43 xyz sendmail[7016]: i46Lah83007016: to=abc@def.co.uk, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30126, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
May 6 17:36:43 xyz sendmail[7018]: i46LahVJ007018: from=<apache@def.co.uk>, size=452, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
May 6 17:36:43 xyz sendmail[7016]: i46Lah83007016: i46Lah84007016: DSN: User unknown
May 6 17:36:44 xyz sendmail[7018]: i46LahVL007018: from=<>, size=2267, class=0, nrcpts=1, msgid=<200405062136.i46Lah84007016@def.co.uk>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
May 6 17:36:44 xyz sendmail[7016]: i46Lah84007016: to=apache, delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=31476, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (i46LahVL007018 Message accepted for delivery)
May 6 17:36:45 xyz sendmail[7019]: i46LahVL007018: to=root, delay=00:00:01, xdelay=00:00:01, mailer=local, pri=32456, dsn=2.0.0, stat=Sent

Do you think this is because of your last note about "but if you need to allow users to pass e-mail through your server from home, you will need to configure sendmail to allow relaying to the outside world"?

If so, yes please could you tell me how to use this feature?

Many thanks
 
Please can anyone help? Could I alter my server settings so it doesn't know my domain email addresses are "local" - therefore it will email them outside the localdomain??

I am desperate to get this working, and it has to be a simple setting, but I cannot find the answer on any forum??
 
Try adding this to sendmail.mc:

FEATURE(`relay_local_from')dnl

This tells sendmail ANYONE with a "From" address with your domain is ok to relay so long as the domain is listed in /etc/mail/local-host-names. Be forwarned that anybody can spoof your domain and send spam through your server by using the return address of bogus@yourdomain.com. This can be a good thing if you want people to be able to send and receive e-mail from home but you should use at minimum pop-before-smtp which will at least check for pop account user name and password before it does smtp mail.
 
Thanks RhythmAce

I have tried this FEATURE(`relay_local_from')dnl with listing the domain in local-host names, but am still getting this mail log:

May 9 06:52:13 xyz sendmail[17826]: i49AqD21017826: from=apache, size=451, class=0, nrcpts=1, msgid=<200405091052.i49AqD21017826@def.co.uk>, relay=apache@localhost
May 9 06:52:13 xyz sendmail[17828]: i49AqDgV017828: <abc@def.co.uk>... User unknown
May 9 06:52:13 xyz sendmail[17826]: i49AqD21017826: to=abc@def.co.uk, ctladdr=apache (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30124, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown
May 9 06:52:13 xyz sendmail[17828]: i49AqDgV017828: from=<apache@def.co.uk>, size=451, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
May 9 06:52:13 xyz sendmail[17826]: i49AqD21017826: i49AqD22017826: DSN: User unknown
May 9 06:52:13 xyz sendmail[17828]: i49AqDgX017828: from=<>, size=2266, class=0, nrcpts=1, msgid=<200405091052.i49AqD22017826@def.co.uk>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
May 9 06:52:13 xyz sendmail[17826]: i49AqD22017826: to=apache, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31475, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (i49AqDgX017828 Message accepted for delivery)
May 9 06:52:14 xyz sendmail[17829]: i49AqDgX017828: to=root, delay=00:00:01, xdelay=00:00:01, mailer=local, pri=32455, dsn=2.0.0, stat=Sent

Just an idea - can i somehow alter the sendmail setup so it thinks it is not from my domain, therefore allowing me to email with *@mydomain.co.uk? As long as it doesn't affect the proper info on my apache web server it's fine. I just don't know which setting controls this.
 
I think I'm getting myself confused here so I have to start all over. First of all, is this only a problem when you try to send mail out using the script or does it do it when using an e-mail client (such as Outlook)also? If this only happens with the script, then that will eliminate a lot of running around. If it happens when you send mail from your client, does it happen only when sending TO certain addresses or FROM certain clients?
 
I have only tried using the script as that's all i need to use sendmail for as all my emails are done on another pc. I know it's a sendmail problem though as before i decided to re-install sendmail after playing about with too many settings, it was sending emails to my *@domain address fine, but not sending them to any others! So basically i have the opposite problem to that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top