Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Our Archives > General Archives > Servers > Mail Server Trouble

 
Mail Server Trouble
Thread Tools
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Apr 30, 2003, 06:46 PM
 
My problem for the longest time has been getting php scripts, including a forum, to send emails out. I think I've figured it out. What I know is that PHP can send mail to me but no one else (me meaning my emails hosted on the same machine). I set up the mail server (OS X Server 10.2.3) to realy mail only from 192.168.*.* and localhost. the first one covered my whole network, and all computer on my network can send and recieve mail no problem. But for some reason, the mail server blocks mail sent from itself. localhost and 127.0.0.1 both don't work, as they are they same thing anyway. My idea is that when PHP tries to send an email, it is given my servers own external IP address, which is dynamic and changes from time to time, and therefore the server doesn't let the mail through, as the external IP is neither a 192 address nor a 127 address. I thought that localhost would definatly let mail through but for some reason its still not working.

SO I'm sure tons of people use OS X Server's mail services. How do you keep the relay restricted, yet still allow mail from the server itself?

[If your solution it so switch to another mail server, whatever your favorite is, then skip it, I'm sticking with the built in mail server, its plenty powerfull enough for me, and works problem free for all mail except this one little glitch]
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
May 1, 2003, 03:51 PM
 
Can't you configure the mail server to accept from localhost/127.0.0.1 and configure PHP to send via localhost?

That would seem to solve the problem, no?
Gods don't kill people - people with Gods kill people.
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
May 1, 2003, 06:15 PM
 
Apple Mail Server is set to relay mail from localhost. As for PHP, i have no idea how you tell it which server to use.
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
May 4, 2003, 05:47 PM
 
Okay, here's my best guess on how to go about configuring sendmail to relay all outgoing mail to Apple Mail Server (MacOS X Server):[list=1][*]Backup up the sendmail configuration file /etc/mail/sendmail.cf e.g.:
cp /etc/mail/sendmail.cf /etc/mail/sendmail.cf.dist
[*]Edit or compile a new configuration file to use SMART_HOST. Compiling a new configuration file is the "preferred" method, but many people prefer to just hack the configuration file. The latter approach is sometimes easier (and quicker), but the former will give you fewer troubles when updating the system and/or making changes to the configuration file in the future. It is also more work. Of course you could hack it now, just to see that it works for you, and do it "the proper way" later. This thread tells you how to hack it.[/list=1]
To compile a new configuration file, you need to locate an appropriate source file. Ideally, it would be the same file Apple uses in the default installation. Under MacOS X Client, /usr/share/sendmail/conf/cf/generic-darwin.mc is the closest source file i've found (could be different for Server), but this file does not seem be the source file (either that, or Apple has hacked their distribution configuration file; i would hope not, but who knows?). Or i may be compiling the source differently than Apple (which is possible since i'm used to doing this under a different BSD). At any rate when i do a diff between my compile of this file and Apple's distribution configuration file, i get more results than i'd like. I expect some differences, like the compile date, but not much more than that. Either i'm doing something wrong in the compile, or Apple isn't sharing their source file with us, or they're hacking it.

Here's how i've gone about it, in any case:[list=2][*]First, make a local copy to play with:
cp /usr/share/sendmail/conf/cf/generic-darwin.mc ${HOME}/mySource.mc[*]Make sure we're working in our local directory:
cd ${HOME}[*]Compile our source file:
m4 /usr/share/sendmail/conf/m4/cf.m4 mySource.mc > sendmail.cf[*]How many differences are there between our build and Apple's?:
diff sendmail.cf /etc/mail/sendmail.cf | more[*]Repeat steps 3 and 4 as necessary/desired to debug.[/list=2]Note that to test, you'll need to move the file you build into /etc/mail/. You can do that with a move, a copy, or during the compile like this:
  m4 /usr/share/sendmail/conf/m4/cf.m4 mySource.mc > /etc/mail/sendmail.cf

Note: For this second compile command to work, you may first have to change the ownership of /etc/mail/sendmail.cf like this:
  sudo chown yourUserName /etc/mail/sendmail.cf

This info should be enough to get SmartHost going. But there are a few other tweaks you should make to eliminate some of the errors which were in your log file. I'll try to post those later. Wanted to get this out to you now.

Please note that i've never actually used the SmartHost configuration option, so i can't help you with the exact setting of its parameters. If it doesn't intially produce the results you're expecting, a little trial-and-error testing is in order. Since you're not running sendmail as a daemon, you shouldn't need to worry about a restart to get changes to the configuration file to take effect.

Good luck young Jedi Knight. May the Force be with you.
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
May 4, 2003, 10:22 PM
 
Well I tried that hack way mentioned in that thread you linked to first, becuase it seemed really easy. It didn't work. I didn't expect it to, becuase you give it the address to send mail to, but both mail server are on the same machine, and you only specify an address, there has to be some other way to tell sendmail specifically where to send the mail, not just to this address, but to AMS. I looked over your other instructions and I just didn't get it, it was either way over my head or you forgot to actually tell me how I make the changes to relay mail through AMS. Either way I'm stuck still right where I've been
Oh yeah and I even rebooted after changing the sendmail.cf even though I shouldn't have to. Still nothing.
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
May 5, 2003, 12:41 PM
 
Well I tried that hack way mentioned in that thread you linked to first, becuase it seemed really easy.
Going through the trouble of building a configuration file probably won't get you any further than the hack, because building the configuration file will essentially recreate the hacked line (unless, of course, its compiled line comes out differently than what you're doing). But...

both mail server are on the same machine, and you only specify an address, there has to be some other way to tell sendmail specifically where to send the mail, not just to this address, but to AMS.
First off, your sendmail shouldn't be responding to incoming mail (you'd have to specifically configure it to answer to a domain name). It's not acting as a mail server, merely as a MTA (Mail Transport Agent). It's also not running as a daemon, so i doubt it would even be able to respond. Examination of the last few entries into your sendmail log as you send test eMails should confirm this (look to see if anything different is going on in the log).

The only way to specify a particular server is by using "machine names." Don't let the terminology throw you; these are virtual machines, not physically distinct boxes, so you could have a half dozen mail servers running on the same box, each with a different "machine name." For example, you could tell AMS its name is "mail", and tell sendmail its name is "smail". Then any mail addressed to "bar@mail.foo.com" would go to AMS, and any mail addressed to "bar@smail.foo.com" would go to sendmail (assuming sendmail were properly configured to act as a mail server, that is). A server could be configured to catch multiple names, or catch the case where no name has been specified, or to answer to any machine name.

I did some poking around on the net. Here is what i learned about hacking it: In your sendmail.cf file, you probably have (or had) a line which looks like this:

  DS

You should have modified this line when you were making your edit to the configuration file. If instead you added another DS line, you should go back and consolidate them into one (preferably at the location of the original DS line). If the line above were to come after the line you added (in the configuration file), it would completely undo the effects of what you added (this is one reason why compiling configuration files is preferred, as it would preclude this kind of thing from happening). The edited line should look like this (although less colorful):

  [color= olive]DS[/color]mail.host.com

The mail. part should be the machine name which AMS is answering to (or omitted if there is no name), and the host.com part should be your domain name.

If this still doesn't work, my guess is you either have the machine name wrong, or you have a DNS configuration problem.
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
May 5, 2003, 06:54 PM
 
how do you give AMS a machine name? And about the DS, it was commented out, so I uncommented it and made it my own, so there was never two.
     
Grizzled Veteran
Join Date: Nov 2001
Location: Oregon
Status: Offline
May 5, 2003, 07:41 PM
 
how do you give AMS a machine name?
I think what you mean to ask is how do you configure AMS to answer to a particular machine name? To that question, i have no idea. I have not used AMS. I assume there's a GUI setting for that somewhere.

Have you simply tried configuring the DS line of sendmail.cf to omit a machine name? I'd start with that. If that doesn't work, then try "mail." If these two fail, then worry about which machine names AMS is answering to. If i were to hazard a guess, i'd suspect it might be "mail."

And about the DS, it was commented out, so I uncommented it and made it my own, so there was never two.
Good.

Now about that other problem you were having with "My unqualified host name (localhost) unknown" error (as per your sendmail logfile), do a cat /etc/hosts and look for lines which look something like the following. If you don't have them, append them.
Code:
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost
But you may have to use something like this to nail that one down (for which you will need the machine name):
Code:
127.0.0.1 localhost mail.yourdomain.com 255.255.255.255 broadcasthost ::1 localhost
     
 
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:43 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2