# sendmail and localhost



## webgodjj (Mar 5, 2003)

Hi,

  I have followed these forums, and by the graces of all, I have PHP and MYSQL running.

  As a webdesigner, this is the greatest thing on earth.  Now i can test my scripts on my laptop!

  However, I have no idea on how to get sendmail to work, how to configure it, or even what to configure.

  Does anyone have a step by step instructions for this?

Cheers,

JJ


----------



## Giaguara (Mar 5, 2003)

This should be quite clear as instructions to start:

http://www.macdevcenter.com/pub/a/mac/2002/09/10/sendmail.html


----------



## webgodjj (Mar 6, 2003)

I have read through the article... Just one quick question.  Is it possible to set this up with just a local ip?  ie 127.0.0.1?  I have a cable modem with a dynamic domain.  I am not really trying to set up a server to serve pages.  I am just trying to test scripts...


----------



## Darkshadow (Mar 6, 2003)

Err...are you talking about sendmail (mail server) or apache (web server)?  It sounds more like you're talking about apache...


----------



## webgodjj (Mar 6, 2003)

Ok.. I guess I should have been more specific.  I am testing a php website that uses mysql database.  Everything works great.

The only thing I can't do is test a scritp that uses the mail command ie:

```
mail("$email", "Your Form details", $message, "From: $u_email");
```

So far it seems to work but email isn't sent.  The script works fine on my server. So somewhere on my computer (apache or sendmail?) I have to configure to send out mail correctly.


----------



## Darkshadow (Mar 6, 2003)

Ah, ok that would be sendmail.  If the mail server isn't running, you're not going to have any email sent.

It was your question about the localhost that got me wondering, that was all.  Sendmail isn't strictly tied to any host - it'll use your domain name (the one you gave your computer, not related to any web domain you have).  If you never changed it, that'll be localhost.

Basically, it just listens in on port 25, and when it receives a request to send mail, it checks the rules in the sendmail.cf config file to see if it should send it, and if it passes all the rules, sends it on.

If you open up the Console, and have it display the log for /var/log/mail.log, you'll see output from sendmail when it tries to send anything (or recieve anything, for that matter).  This could help you out in getting sendmail working correctly.


----------



## webgodjj (Mar 6, 2003)

This is part of the line in the log file

NOQUEUE: SYSERR(root): /etc/mail/sendmail.cf: line 93: fileclass: cannot open '/etc/mail/local-host-names': Group writable directory


----------



## Darkshadow (Mar 7, 2003)

Oh yes, that's a pretty famous error.  To fix it, go to the terminal and type *sudo chmod g-w /*.  Sendmail is complaining that the root directory is group writeable, and that command takes write permission for the group away.

Unfortunately, any time you update the system (or run a fix on permissions), you'll have to do this again.  You'd *think* that Apple would work around this one....


----------



## webgodjj (Mar 7, 2003)

Kool.. fixed that problem.. thanks!  Now here is the next:
"Connection refused by localhost"


----------



## hazmat (Mar 7, 2003)

> _Originally posted by Darkshadow _
> *Oh yes, that's a pretty famous error.  To fix it, go to the terminal and type sudo chmod g-w /.  Sendmail is complaining that the root directory is group writeable, and that command takes write permission for the group away.
> 
> Unfortunately, any time you update the system (or run a fix on permissions), you'll have to do this again.  You'd *think* that Apple would work around this one.... *



You could also change the sendmail lines in the startup script to:

/usr/sbin/sendmail -OdontBlameSendmail=GroupWritableDirPathSafe -bd -q1h

/usr/sbin/sendmail -OdontBlameSendmail=GroupWritableDirPathSafe -C /etc/mail/submit.cf -q1h

That's what I do.


----------

