Terminal, Sendmail/Postfix, and shells

Discussion in 'Mac Apps and Mac App Store' started by Bedawyn, Oct 30, 2004.

  1. Bedawyn macrumors regular

    Joined:
    Jul 17, 2003
    Location:
    Asheville, NC
    #1
    Anyone want to drop clues on a Unix newbie? I used it briefly many many years ago, and hated it then, and since then have only used it within the context of MUDs.

    I've been trying to work through the Terminal tutorial at MacDevCenter, and ran into a problem. It gives directions for setting up sendmail, but the file it mentions, sendmail.cf, doesn't seem to exist on my machine, at least not that I can find. It's got a man page for sendmail, but that seems to be all. It does have seem to have Postfix, and when I try to send mail, it seems to work, but it doesn't actually send. I get

    Oct 30 22:24:04 mirabelle postfix/local[666]: 026254DABA: to=<Sabrah@mirabelle.local>, relay=local, delay=0, status=bounced (unknown user: "sabrah")

    and

    Oct 30 22:27:59 mirabelle postfix/smtp[677]: 048454DACC: to=<journey@his.com>, relay=his.com.s5a1.psmtp.com[64.18.4.10], delay=19, status=bounced (host his.com.s5a1.psmtp.com[64.18.4.10] said: 553 5.1.8 <Sabrah@mirabelle.local>... Domain of sender address Sabrah@mirabelle.local does not exist - on relay of: MAIL FROM:<Sabrah@mirabelle.local> (in reply to RCPT TO command))

    The latter actually makes sense; I wasn't expecting HIS to accept it anyway. But what's going on with the former? Why would it let me send the mail without an error message if it thinks I don't exist? How can I make this work? And -- would it be possible to set it up so that I can send to/from my regular HIS account? For instance, if I wanted Mirabelle to send alert messages to my regular account when I'm out of town and checking my HIS mail via web cafes or whatnot.

    A couple other differences with that tutorial:

    + It's talking about tcsh, but I seem to be using bash.
    + It has a % after the username, where I have a $.

    The tutorial was written for Jaguar, and I'm using Panther, so I assume that explains some of the differences. But what do the differences mean?

    Finally, is there a way to make it stop showing the username with the prompt, and to change the prompt to something more interesting than the computer name?
     
  2. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #2
    As you suspect, you're running into the changes that occurred between Jaguar and Panther. In Panther, the default shell is now bash (you can set it to use tcsh, although I don't know why anyone would want to). Also, postfix is the mail daemon, probably because sendmail is big and bloated and prone to remote exploits. :D Postfix does have a sendmail compatibility mode.

    The "mail send" issue is completely different. In order to control spam (or attempt to), a lot of mail servers now refuse to accept connections from mail servers that have a dhcp address, such as yours. If you don't have a static IP, you generally can't be looked up in reverse DNS (which seems to be the source of the actual bounce-back error you received).

    Generally the best thing to do is use your ISP's SMTP server. They should provide a method for authenticated connections if you're not always on their network - if they don't, complain.
     
  3. Bedawyn thread starter macrumors regular

    Joined:
    Jul 17, 2003
    Location:
    Asheville, NC
    #3
    There's actually much more discussion of this at MacDevCenter... but for some reason it was hidden a few pages back, instead of at the bottom of the page where I expected to find it, so I only just ran into it now. Ah, well, I trust you guys more anyway. :)


    I think what I'm asking is if there's a way to tell Postfix to use the smtp server, to log in and send mail from (and to) my normal ISP account on its own when I'm not physically present to use my mail app.
     
  4. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #4
    Okay, just to be sure we (and anyone else reading) are on the same page: Are you running your own incoming mail server on your Mac? The paragraph I've quoted above seems to indicate not - it sounds like what you want to do is to send and receive e-mail using your ISP account, just like the vast majority of people do. If this assumption is correct, you shouldn't have to be concerned with running your own smtp server (sendmail or postfix) at all. E-mail programs normally talk directly to the ISP's smtp server.

    Maybe I'm just being really dense, but (if my assumption is correct) what is it that made you think you needed to do anything with sendmail/postfix?
     
  5. yellow Moderator emeritus

    yellow

    Joined:
    Oct 21, 2003
    Location:
    Portland, OR
    #5
    Please, I am BEGGING you, before you turn on postfix and config yourself a SMTP server..

    Do some research on postfix and how to keep it secure. I don't want to get more spam because a self-confessed "Unix newbie" now has an open relay.
    Please..

    At least you're not using "Postfix Enabler".
     
  6. Bedawyn thread starter macrumors regular

    Joined:
    Jul 17, 2003
    Location:
    Asheville, NC
    #6
    *snerk* I'm not interested in setting up my own mail server.

    And I don't _need_ to fuss with Sendmail or Postfix. I was trying to because that's what the tutorial happened to use, setting it up so the system would send you mail when the cron jobs were completed successfully.

    However, although it's not necessary, I can see instances where it might be useful for the system to be able to send me mail at my regular address -- for instance, last week when I was out of town, and one of my timed schedules screwed up. If the system had been able to send me an alert, not to the local user account (which I wouldn't have seen until I got back) but to my ISP account (which I could check via the web), I could have seen that message when I was out of town and gotten my roommate to go fix the problem, instead of coming home to find my computer had been hung up for days just waiting for someone to hit "enter".


    Yes, but only when I'm physically present to tell them what to say. :) I'm asking whether it's possible to tell the system to send mail from me (actually from the system, but from me as far as the ISP is concerned) to me, via the ISP's server. It's certainly possible, since my GUI mail apps do it all the time; the question is how do I tell the system to use the same settings Apple Mail and Entourage use instead of trying to send from "me@local", which of course my ISP doesn't recognize as valid.
     
  7. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #7
    Well now we're back to the first comment I made in this thread. It is fairly likely that your ISP's SMTP server will reject connections from any SMTP process that's on a DHCP address (such as your local machine's sendmail process), because of anti-spam concerns. That's certainly what your original error messages looked like to me.

    Also as a side note: to accomplish what you are asking (this is independent of any connection issues per my previous paragraph) you don't need to run the sendmail or postfix daemon for this. You can have your local program invoke it as needed from the command line. This is done quite often on servers that don't normally handle mail - for example if you've got a mail form on a webserver. You should be able to do this with a bash script.

    However something still isn't clear. You say your GUI mail apps "do this all the time". Unless you're doing something really unusual, you are not really grasping how your GUI mail apps work. They don't invoke smtp on your local machine - they connect directly to your ISP's smtp daemon via port 25 (assuming it's not SSL-only). This is certainly something that'd be possible to script since it's a plaintext process (pretty much like invoking smtp on your local box, but over port 25). There are Perl modules that will help you to do this - but you need to learn how to write Perl. For that matter it can be done with PHP, or Python, or just about any available scripting language. But you'll also have to read up on how SMTP exchanges work.
     
  8. Bedawyn thread starter macrumors regular

    Joined:
    Jul 17, 2003
    Location:
    Asheville, NC
    #8
    Yes, actually, I do understand how my GUI apps work. What I don't understand is why the UNIX app can't work the same way. I don't want to invoke smtp on my local machine, and I'm not sure where you guys got that idea.

    There is _something_ on my machine that runs when I type "mail" and tries to send a message, which the system can use to send mail to my local account. I had assumed that that "something" was Postfix, since that was what came up in the error messages, but maybe it's something else and that's where the confusion comes in. (Right now I'm thinking that "something" is just called "mail", but since that's confusing with Apple Mail and with general usage, I'm going to keep calling it "something". *g* At least there's only one "something" in the discussion.)

    I would like that something to be able to do exactly what my normal mail apps do: send the mail through my ISP's smtp server. Saying it won't work just because it's coming from my local computer doesn't make any sense -- if I send mail right now from a GUI app, it's still coming from my local machine, going out to the ISP's server, and then on to wherever else. I don't understand why UNIX's "mail something" shouldn't be able to do that too, if I knew how to give it the same information that's in my GUI apps' settings files and make it use my normal address as the From header. I said in my first post that I wasn't surprised that that message had bounced, because I knew I hadn't yet given the "mail something" the settings it would need to convince the ISP's smtp server that it was an authorized user and because it wouldn't know the right header to use. I assumed there was a fairly simple way to tell it which settings to use, but from what you're saying it sounds like that's not the case.

    I appreciate your taking the time to try to answer, but I'm afraid this discussion really isn't helping. :) Since I was only asking for understanding's sake and possible future use rather than for immediate need, if there isn't an easy way to do it, then I'm ready to wash my hands of it.
     
  9. Westside guy macrumors 601

    Westside guy

    Joined:
    Oct 15, 2003
    Location:
    The soggy side of the Pacific NW
    #9
    Okay, after this explanation then I will drop it. :D

    We got the idea because in your opening post you were talking about running sendmail and postfix on your machine. SMTP service is what sendmail and postfix provide. SMTP is why they exist.

    Also, when I discussed scripting I was trying to explain to you exactly how a *nix program can do what you were asking. I guess I should have explicitly said that I felt you should try to understand the process involved, because SMTP can cause a lot of problems when people approach it in a cookie-cutter fashion (that is the source of yellow's comments about open relays).

    "mail" is a very basic, command-line-based, program for mail handling. A very primitive relative of Mail.app, Entourage, and Eudora in other words. You can learn about it by typing "man mail" at the command line. Actually, that's a good way to learn about postfix ("man postfix") as well. *nix provides help pages for most available command-line applications - you get to them with the "man" command (man stands for "manual").

    The end. ;)
     

Share This Page