![]() |
Sendmail => AppleMailServer
I run OS X 10.2 Server on my server, and I use Apple's built in mail server. It works absolutely perfect for me, no problems whatsoever! Where I do have problems is PHP. It sends emails, as far as I can tell, by directly communicating with sendmail. I don't use sendmail. What I need to do is get sendmail to automatically forward all email to my AMS so it can be delivered. The way it works right now, PHP can send emails to ME, which is always a local user on the mail server, but it can't send anything OUT. I post this in this forum because I'm not great with the command line and I know how impossible sendmail is to configure so if I have to edit sendmail stuff, you're going to have to talk really slow! :D
|
I believe your PHP.ini file has something called 'sendmail_path=' You can set that equal to the program you are using along with the necessary parameters. However, I'm not sure if it works the same way at all.
You could also do it manually yourself, since mail() is, after all, just a wrapper. Here is an example of a function I wrote to use mail rather than sendmail. You could just code something similar that would work. Code:
function sendmail($to='', $subject='', $message='') { |
Anyone know of a way to do it just without changing the scripts? I have lots of phps running, including two vBulletins, and I don't wanna hack through all of the files and any future scripts i might get to make it work.
|
php comminuicates to sendmail through the command line, even if you are using mail() and not writing your own mailer equilivant. unless AMS can be accessed through the command line, or you write your own php module to communicate to AMS, your best bet is to either configure sendmail to deliver the mail or configure sendmail to comminucate directly with AMS.
The bottom line is that you probably don't need to have php deliver mail through AMS. Sendmail is more than capable of the job. And you won't need to make any modifications to php or any of your scripts. |
Quote:
|
before I suggest how you would go about getting sendmail to talk to AMS, why would you not want to have sendmail do the delivery, rather than passing it on to AMS? the reason I ask is that in either case you have to do some messing with sendmail configuration.
|
Because I already have AMS working perfectly as my own mail server, and I read that Mac OS Updates can often mess with sendmail. It just seems easier and quicker to have sendmail just pass to AMS rather than maintaining two full functionaly mail servers at once, you know what im saying?
|
It is true that Apple's updates can mess up Sendmail, but that can be worked around. Since in either case, you will be using Sendmail at some point in time, it makes no difference whether Sendmail delivers to AMS or delivers directly; if Sendmail is broken, it won't deliver, period. The only real advantage to having Sendmail relay directly to AMS is if you have to change your delivery path, you only have to alter AMS.
As a side note, if the only php scripts that you currently use to send mail are your boards, you should see if they have an option to send mail through SMTP rather than Sendmail, as then you won't need Sendmail at all. Since I have never had one mail server talk to another mail server running on the same machine, and since I don't have AMS myself, what follows is pure theory: On your machine is a file: Code:
usr/share/sendmail/conf/cf/generic-darwin.mcOpen it up in your favorite text editor and add this line: Code:
define(`confDONT_BLAME_SENDMAIL', `GroupWritableDirPathSafe')Right now, if you have a valid domain name, Sendmail is ready to deliver mail. If your machine doesn't have a valid domain name, add the line: Code:
define(`confDOMAIN_NAME', `VALID.DOMAIN')Here is where things go theoretical. If you want Sendmail to relay through AMS rather than delivering directly, add the following: Code:
define(`SMART_HOST',`smtp:localhost')Now, to convert your config file into something sendmail understands, you need to do the following on the command line from wherever your working config file is: Code:
> m4 /usr/share/sendmail/conf/m4/cf.m4 meaningful_name.mc > submit.cfCode:
> cd /etc/mail/And the email should show up in your inbox, and if you look at the headers, you should see it was routed through your AMS. Like I said, this is all theory, since I can't try it myself. |
Before i try i need you to clear up one thing. My machine is on a quasi dynamic ip, which changes usually once a year or less. I have 4 domain names that sendmail is going to be forwarding mail as, but my ip reverse dns's to my isp's own long name, not one of those domain names. How would I enter this info into the mix?
|
You can either specify a domain with confDOMAIN_NAME or leave that option out and it will use your isp's name. You only need to specify a domain name if your machine can't resolve itself or if you want to force a domain name. As long as php always specifies a FROM header when passing mail to sendmail, no one will ever see the domain name unless they look at the headers. If no FROM is specified, then the end user sees a 'FROM: www@whatever.domain.sendmail.thinks.it.is'
|
So if i skip it and AMS is set to accept from my servers own internal IP then everything should work nice?
|
as long as AMS accepts mail from your isp assinged name, then yes, in theory. I don't know how AMS restricts connections. Spam protection and all... You can try without and see what happens. If the mail goes through, all is good. If not, look at the logs and see if it was denied or if there was some other connection failure.
|
OK it doesn't seem to be working. I did a search and i couldn't find any new submit.cf files? Where is it supposed to be at? I left it as is thinking maybe it automatically replaced the old one but i tried what you said to send an email and nothing seemed to happen at all, like its timing out or something. Any ideas?
|
are you looking for the submit.cf you created? if the end of the m4 command was "> submit.cf" it will be in whatever your working directory was when you issued the command. it won't automatically replace the old one. the old one exists at /etc/mail/submit.cf and that is the only place sendmail will look for it.
as far as where your mail went, you can type Code:
> sendmail -bpCode:
> tail /var/log/mail.log |
OK This is what happens, I make the mc file just like you said, and when I try to make the submit.cf file, this is what I get, I have no idea what it means.
Code:
[blah]jon% > m4 /usr/share/sendmail/conf/m4/cf.m4 customamsforward.mc > submit.cf |
ok, i see what is going on. you need to drop the '>' at the beginning, i was just using those to designate what you type on the command line. the command starts with 'm4'. from your prompt, it would look like:
Code:
[blah]jon% m4 /usr/share/sendmail/conf/m4/cf.m4 customamsforward.mc > submit.cf |
OK now i run it and from some places like the sendmail.conf.m4 directory, i get a "Permission denied" error, even if I sudo it. If I run it form the root of the drive, so the submit file would 'come out' there, i get a "m4: Command not found" error
:mad: I'm not liking this one bit! |
without using sudo, run the m4 command in your home (~/) directory. I can't imagine why m4 woud be an unknown command, but if it keeps that error up, try tacking /usr/bin/ to the beginning of the m4 command (/usr/bin/m4 ...).
|
Quote:
|
that sounded kinda confusing, to clarify, i DO have the BSD subsystem installed, I do NOT have the Devtools installed.
|
that could be why. type 'which m4' and if it returns a path to m4, then there you go. if it returns 'command not found' then you need the developer tools. i didn't think to ask that.
|
m4 is of the dev tools:
Code:
$ grepbom /usr/bin/m4 |
:eek: It said /usr/bin/m4 !!!!!!
|
Keep in mind I'm running 10.2 Server, not "standard" 10.2
|
well, now that's pretty funny. we've confirmed that m4 is part of the dev tools, and yet you haven't installed them and your machine thinks it's got it. try "ls -al /usr/bin/m4" and see if is really there.
|
Result
Code:
-rwxr-xr-x 1 root wheel 97892 Dec 19 2002 /usr/bin/m4 |
well, that confirms that you do indeed have m4 installed, which means that all or part of the dev tools got installed at some point. and none of this is affected by having 10.2 Server. try "m4 --help" and it should print a quick list of options.
|
I'm so dumb. I didn't notice that I was no longer SSH'd into my server, it must have timed out or something? Well my server does indeed NOT have m4 installed, so I need the dev tools for that? I'll install that tomorrow night and pick up this thread where we left off. You've been very helpful so far, please keep on helping :D
|
:)
i've done the opposite. issued commands on local files over SSH! good luck. |
I wish SSH had like, colors or something :-D
|
never tried this myself, but someone else has a way to do just that:
http://www.macosxhints.com/article.p...30213071650891 |
why not just copy the m4 executable to your server rather than install the entire dev tools?
|
because I don't wanna get caught short handed every again.
|
... to be able to move forward and focus on your current problem. you can install the dev tools later.
|
OK i did installed the Dev tools and ran the m4 thing and got the file and everything worked great. But it appears that I still can't send email to anyone but myself, though sendmail. :-( Now what?
|
1) how did you configure sendmail?
2) what showed up in /var/log/mail.log? 3) what does 'sendmail -bp' say? |
I configured it using exactly what you said in the beginning, the log from today looks like so...
Code:
Jul 1 03:15:01 PowerMac-Dual533 sendmail[1168]: NOQUEUE: SYSERR(root): /etc/mail/sendmail$Code:
johnm% sendmail -bp |
see if this makes a difference: copy submit.cf to sendmail.cf:
Code:
sudo mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf.old |
still nothing
|
first, make sure there are no sendmail processes running. those processes won't see the changes. after that, check the logs and sendmail -bp again. if you are still getting the same errors, send the .mc file you used.
|
too tired, ill have to pick this up again tomorrow, until then...
|
OK I've been away for a while but now I'm back, can you give me your email address and I'll send you that file?
|
|
| All times are GMT -5. The time now is 10:25 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.