How to configure sendmail or postfix on Ventura

Hello. Actually, the full title of my post should be “How to configure sendmail or postfix on Ventura for old school messageboard email notifications?”

At any rate, first, my specs:

macOS Ventura 13.6
Retina 5K 27-inch 2017 iMac

I run an old school messageboard on my web server. It is a PERL script. Yes, I know. :)

At any rate, the messageboard script requires the sendmail or postfix binary in order to send email notifications to users. I have visually verified that both binaries are in usr/sbin, as they should be.

However, quite some time ago – years in fact – the email notifications stopped working on my messageboard. IIRC, at that time, I found a postfix setup somewhere which seemed to fix the problem.

But, here we are, quite a few macOS versions later, and email notifications are not working on my messageboard. I imagine that my problem could possibly be a combination of Apple making so many changes to macOS, plus my not knowing what to do to get either sendmail or postfix working again.

I did search the web for a solution, but all the pages I found contained info which was years old, and multiple macOS versions ago.

So, if there are any technogeeks here who can help me to figure this out – pretend I don’t know anything – I would be really appreciative. Please give me the dummies version, because I am not the brightest crayon in the box. Thanks so much in advance.

You know, it might be worth asking ChatGPT or Bard about this if no one has a specific solution. It’s likely that there’s enough written about sendmail and postfix that the AIs can piece together useful information.

Thanks! Now that is something I had not thought of doing. Question: I do not see the post that I tried to make two days ago in the “Discourse” section of your site. Does that mean that it was never actually posted because my account was on hold, and I need to post it again? Or was it posted somewhere else on your site?

Oh gosh! Ignore my last question. I now see my post on your site. :)

I wanted to add some additional information regarding my situation, in the hope that I might possibly be able to get a solution here.

  1. When I enter “sudo postfix stop” in the macOS terminal on my iMac, I get “stopping the Postfix mail system.”

  2. When I enter “sudo postfix reload”, I get refreshing the Postfix mail system."

  3. When I enter “sudo postfix status”, I get “the Postfix mail system is running: PID: 27656.”

So, don’t those responses mean that Postfix is in fact working properly already?

For the record, I waited a few minutes before entering “sudo postfix status”, because I had read on another website that Apple forces postfix to exit after a minute or so. Yet according to the response I got, postfix still seems to be running, even though a few minutes have passed.

So is the problem possibly that the old messageboard cgi script I am using simply no longer works for sending emails?

Other than this one problem, my board works just fine.

However, regardless of whether I use “usr/sbin/sendmail” or “usr/sbin/postfix” in the mail settings for my messageboard, I am not receiving an email notification for my new post.

Please note that I use a different email address for my messageboard admin account, and a different email address for my user profile, as instructed by the developer of the script years ago.

Also, I even checked my online gmail account’s spam folder – in addition to Mail app’s spam folder – to see if the messageboard email notification was stuck there, but it wasn’t.

Does anyone here have any ideas how to get this working again?

Even more drastic, if need be, does anyone here have an interest in taking a look at the cgi script that I use? It is a commercial script which I purchased at least fifteen years ago. Since then, the developer has disappeared, and the script is no longer even sold. So, I don’t think there would be a problem with someone messing with its internals.

Is perl still there? Apple sometimes drops apps that you and I think should be standard on any Unix-like system.

If it’s missing, you may need to install a copy for yourself (e.g. via Homebrew, MacPorts or Fink).

1 Like

Thanks for the reminder. Actually, I did think of that the other day and did check. While PERL was installed, one dynamic library was apparently missing, so I used Homebrew to reinstall it. I think it is version 5.38, which is the latest. My messageboard works perfectly fine – which means that PERL is installed – it is just email notifications which are not working properly.

Have you tried just typing sendmail (substituting your own email address) on the command line, then entering a subject and a message body ending with a . on a line by itself? If that works and you get the mail, that means that postfix is working okay and the problem is likely with the perl script. If it doesn’t work, perhaps you’ll get an error message that will point us in the direction of a problem.

I’d be happy to look at the perl script, at least briefly, and see if any obvious problems jump out at me. You can email me off list (ron at risley dot net) and we can coordinate. I have many perl scripts that interact with postfix. Most are running on gnu/linux boxes, but a couple are running under macOS.

1 Like

Hello Ron. Thanks for offering to help. I confess. I never use the sendmail binary in the Terminal. So. just trying to figure out how to send mail that way is challenging.

First I typed “sendmail ” – without the quotes – entered my email address, and then hit my return key. Going by what you wrote, I expected that the Terminal would prompt me for a subject. However, after a few minutes, it didn’t. I just had a blinking cursor.

So I tried again, but this time, after entering my email address and hitting the return key, I typed a second line for the subject, and then a third line as the message body, and then finally on the fourth line, I typed a sole period and hit my return key.

Well, nothing happening. No indication the message had been sent. No error messages. No new email in my inbox. I even went to my online Google account to see if the message might be stuck in the spam folder. Nope.

So, I went online to figure out what I was doing wrong. Several sites said different things. One site said to use “usr/sbin/sendmail” as the command, instead of just “sendmail” by itself. That didn’t help.

Another site said to actually type out the word “Subject” with a colon, and then type the subject. I did that, but that didn’t work either.

Another site said you could use control-d to send the message. That didn’t help either.

Another site said to use something like this:

Subject: This is a sendmail test
I am testing out the sendmail binary to see if it is working properly.

When I used that, the terminal asked me if I wanted to see all 897 lines. What? Lines of what?

Another site said that the postfix configuration file had to be setup first. I have never done that. Could that be it?

No matter what I tried, no emails reached my inbox, and there are no emails stuck in Google’s spam folder online.

BTW, I checked my ports in my router, and I do have ports 25 and 587 open.

So, if I can’t even figure this out, it is pointless to even try to get my messageboard script to work. Maybe I should just drop it and not waste any more time on it. After all, my messageboard is dead. I was just hoping to learn how to do this properly, and get my messageboard emails working, just for the sake of learning at the least.

Your question, essentially, amounts to “How do I get mail sent from my Mac via the Sendmail binary that is included with UNIX mail transfer agent software like the version of Postfix?” This is a reasonable question, but there are complicating factors on the modern 'net, the likes of which sadly mean that you are likely to experience problems if you don’t take steps to understand and configure the mail system correctly. For the use case you’re talking about, I think setting up relaying to another system from a simple mail transfer agent is the best approach.

Before you do anything else, can you please tell us whether you can guarantee the email addresses you will be using in your messages will be fixed (not changing), and that this sendmail will be used for nothing else but this forum software?

And can you tell us which provider those addresses will be from? (So far, you’ve mentioned Gmail exclusively.)

From your description, I imagine what has happened is that, in the past, you have simply used the default direct mail delivery configuration from the included Postfix, but that in the contemporary environment that has stopped working because sending mail from an address not under your administrative control is verboten and you shouldn’t do it because that’s now a hard check being imposed by recipient systems including Gmail.

sendmail is invoked with recipient addresses as arguments, the message (including headers and blank line) is fed on standard input. In a shell, you mark end of input by pressing Control-D. Use the “-t” argument to say that recipients should be read from the headers (instead of supplying them as arguments); use the “-f sender” to specify the sender (replace “sender” with an address). Type man sendmail to read the documentation for the command. (Historical note: it’s called sendmail because that was the grandfather mail system, and all subsequent mailers have to have compatibility interfaces that try to replicate its behaviour, including Postfix.)

You said that you can change the binary used by the script. Good–I think that’s the route to your solution. Don’t use the included Postfix because it’s hard to configure and keep running, instead using an alternative, simpler program to do the job.

This is a solvable problem. There is no need for fatalism! That way lies despondency, resentment, cynicism, and possibly death. :)

1 Like

Hello Sebby. Yes, that is basically what I have been trying to do. I have inquired about this in a variety of places on the web. Aside from this forum, there are only two people who have responded to my inquiry. The first person on ASC wasn’t able to help. The second person offered a solution which you will find at the URL below:

If you visit there, you will see that he and I have been having an exchange, but he has not yet responded to my latest group of questions, which are based on the instructions he provided on his blog.

As you will see, he suggests a rather long, complicated process for getting postfix to work, some of which is a bit over my head. Thus far, I have only installed stunnel as he suggested. The rest I have not done yet, because I am waiting for some answers to the specific questions that I asked him, which he has not posted yet.

In your comment above, you mention using a relay. If you visit his page, you will see that this is what he seems to be doing as well.

I have googled this issue quite a bit over the past few days, and the various pages I have visited all seem to give different advice, including what terminal commands to do. What I have discovered is that a lot of the advice is outdated, and is based on past macOS versions. In fact, when I tried some of the commands they suggest on my iMac running macOS Ventura, it doesn’t even recognize the commands.

Anyway, years ago – like 15 years ago or longer – when I first set up my messageboard, all I had to do was to enter the path usr/sbin/sendmail in the mail preferences in the script. That was it. No configuration anywhere. It just worked.

Then one day, years ago, email notifications just stopped working. So I assumed that it was either due to the cgi script being outdated, or due to so many changes being made – particularly security changes – in more recent versions of macOS. I in fact recall reading somewhere that Ventura – or maybe Sonoma? – broke sendmail, or maybe postfix, or both.

Anyway, I am not sure if that other fellow is even going to continue to respond to me or not. I kind of got the sense that perhaps he lost patience with helping me. But, if you look at his page, and think that what he is doing is what you are also suggesting, then perhaps you can answer my specific questions, so that I can continue to try to set this up according to what he posted … unless, of course, you have an easier solution.

Regarding your questions. in my messageboard, I uses two email addresses. One is my messageboard admin email address, and the other is what I use in my actual user account on the board.

The email address I will be using as my “From:” address for all messages which will be sent out from my board to board users will in fact be one and the same. It is a gmail address which I have used for a very long time.

Regarding your second question, yes, I never use sendmail or postfix on either of my two machines. So sendmail or postfix will only be used to send email notifications from my messageboard.

In your comment you stated “You said that you can change the binary used by the script.”

What I meant by that is that in the mail setup in the messageboard’s configuration, there is a link, which if I click it, it will scan my system and then report the path to both sendmail and postfix. That is why I said I can use either one. In fact, I quickly examined the actual cgi script earlier today, and one string of code under the “default settings” section says " $mailprog = ‘/usr/sbin/sendmail’;". So that is the default setting for the script. I believe that is always how I have had the setting set in the messageboard mail preferences. But I assume that I could just as easily put “usr/sbin/postfix” in the preferences, and it would work.

Therein lies the problem. It is NOT working, which is why I have been scouring the Internet trying to find a way to fix it. For all I know, maybe I just need to make some changes in the postfix config file, but I am not sure, and I would need help doing it, probably.

Lastly, you wrote “Don’t use the included Postfix because it’s hard to configure and keep running, instead using an alternative, simpler program to do the job.”

Honestly, I don’t know if that is an option or not. I mean this cgi script is so old, I don’t know if it would even recognize anything other than sendmail or postfix.

Before closing, I wanted to ask you to please address what I wrote in my previous comment. That is this:

  1. When I enter “sudo postfix stop” in the macOS terminal on my iMac, I get “stopping the Postfix mail system.”

  2. When I enter “sudo postfix reload”, I get refreshing the Postfix mail system."

  3. When I enter “sudo postfix status”, I get “the Postfix mail system is running: PID: 27656.”

So, don’t those responses mean that Postfix is in fact working properly already? Or could those responses mean that while it is running, it is still not working properly?

Thank you for your time and patience in helping me with this. I appreciate anyone who can help me to figure this out, because I don’t have the expertise to do it alone.

Not sure if we should take this off-list. The non-response from the sendmail command (which is actually a postfix module that emulates sendmail) is what you expect; it implies that postfix is more-or-less working. There are lots of things that can go wrong (including your ISP simply blocking outgoing mail), but I suspect that if you just type the command mail with no arguments you will see a list of messages with the subject “Undelivered Mail Returned to Sender”. If you view one of the messages (by typing the number in the second column of the message list) it will probably say that gmail is rejecting your messages because you’re an unauthenticated sender or have made too many connections to gmail. Or it might say that the domain is unreachable, in the event that your ISP blocks outgoing mail.

If either of those things are the case, then you’d want to configure postfix to use your ISP’s mail relay, though you should be aware that they will have some limits on how many mails you can send in a given time period.

Thanks for your reply, Ron. It is 3:25 AM Thursday here, and I just jumped in bed, so I am going to have to get back with you on this sometime later today after I’ve slept a bit. Perhaps you can also have a look at the page that I mentioned to Seppy and see what you think. Thanks, and until later.

I’d like to read about your progress. If you think it’s going to get too technical to share with the world, please remember to post a summary after you get it all up and running - so the next person with this problem will be able to follow your example.

Just trying to help you with your basic question. (Other here knows more about Postfix/Sendmail/Mail security).

When I type sudo postfix status in Terminal on my brand new mac.
I get
postfix/postfix-script: the Postfix mail system is not running

So when you get “the Postfix mail system is running: PID: 27656.” we know Postfix is indeed running, but that is no confirmation that the configuration is correct. You have the motor, but there is some missing cogwheels.

I too would like to read about your progress and if you get it working, I will try to get mail up and running on some of my macs. Many years ago I had the error messages sent to root rerouted to me. It broke and I have not tried to get it up and working again.

Ron, I just did as you suggested. There are NO undelivered message notifications in my available system mail. There were only 2,437 messages from a system cron event, which I just deleted. There were no other messages than those. In addition to that, until very recently, I was running a social network which likewise sent out email notifications to my users through an email account with, in conjunction with SendGrid. None of those outgoing messages were ever blocked. In fact, in all my history with my ISP – which goes back years – they have never blocked any of my outgoing email.

Have you looked at the blog page I shared in my previous comment? As I said previously, I have a set of specific questions I would like to ask here, but it would be to no avail if no one here has examined that page. That person does describe setting up some kind of relay. But, it has been two days since I asked him my questions, and I suspect that he may have lost interest in helping me further.

Oh, regarding relay limits, that would not be a problem, because my old school messageboard is dead at the moment, and I cannot even seriously try to revive it, unless I get email notifications working first.

Shamino, let’s wait and see if I can even get that far. I imagine that there are probably at least a few other people who are stymied by not being able to get sendmail/postfix working for them properly in newer versions of macOS.

Folks, just so you all understand, I cannot proceed with trying to get this to work until someone knowledgeable here visits the URL I mentioned earlier. The person on that blog may have the right solution, but I cannot even follow it through until some aspects regarding his method – more specifically, certain parameters I must set on my end – are answered.

Thus far, he has not seemed willing to do that. I think he has lost interest. But, if someone reads what he wrote on his blog, and understands it properly, then I will post my five questions here.

Or, I would even be willing to take this private via email, being as my five questions concern setup parameters which I really prefer to not make public here.

Again, the URL to visit is the following:

Hi Bill.

The solution linked is certainly, if followed, a correct and valid solution, albeit that understanding it might require some knowledge of system administration and the SMTP and related protocol. I suggest a simpler solution involving the much easier-to-configure OpenSMTPD server (available in MacPorts, where you got stunnel if you’ve followed the instructions up to that point) because it has fewer steps and complicating factors, but yes, you can indeed get the built-in Postfix working if you

  • Write a new launchd job to start it running persistently, instead of just temporarily to process the maildrop queue (note: using the postfix command is not the way that launchd and the system starts it, see discussion below)
  • Run stunnel (also using launchd to start it) to wrap a TLS-on-connect server like Gmail
  • Write suitable configuration lines to relay via Gmail
  • Ignore the increasing age of the bundled version of Postfix (as of Ventura, it’s still 3.2.2, from 2017, although in truth that’s not the biggest deal in the world if you’re using stunnel)

There is no doubt that you’ve picked a fairly hard fight, but honestly, that’s probably true anyway, and it could be an interesting learning experience for you. If this is the route you’re taking, feel free to ask any questions about the process you feel you need specific answers for. I will try to address the questions and points so far.

The tutorial (and I) recommend using a relay because that’s how you send reputable email. Because your email is coming from Gmail addresses, it must come from a server under Gmail’s controls. Various technical measures implemented by ISPs and by receiving servers mean that this step is not optional nowadays; your only other option is to buy and own a domain, and then either configure a trusted relay for it, or set up and use your own email server on the public Internet whose reputation you will monitor and guard yourself. Obviously, I don’t recommend going down this path, just now. Yours is a problem that can be solved by relying on a trusted relay, like Gmail’s, with limited effort. It is very, very common when using an ordinary email client; using a traditional UNIX mail system is only slightly more tedious. (Note: you don’t need any ports forwarded in your router; you should delete those mappings you made to keep security tight.)

If I understand correctly, you are actually using a single Gmail address to send from Gmail using this software. In that case, get the app-specific password for this single account, and as long as you are using this single address exclusively in your configuration, you should be fine. The admin account can still be used for other purposes, but you must make sure that you don’t try to send mail “from” another address for which you haven’t authenticated to Gmail, because that mail will probably be refused. The guide, as it stands, should work to set this up–just don’t use the mail system for anything else.

Concerning the sendmail binary, the only important question is where it is. Type which sendmail to find it. If that is in your script, then great, you’re done. sendmail (whether it comes from the original Sendmail program (now owned, I believe, by Proofpoint), or from the Postfix mail system, or from Exim, or from OpenSMTPD, etc) behaves, for all intents and purposes, in exactly the same way; it does not matter which mail system you are using, because the command line syntax is close enough that applications will be able to use it to submit mail. Think of it as a library, rather than a command line program; it just has to mimmic a compatible interface to be useful. macOS ships with Postfix, which was intended as a secure replacement for the notoriously buggy original Sendmail™ program; the solution I recommend has you install OpenSMTPD and use the binary installed into MacPorts at /opt/local/sbin/sendmail. (Note: postfix is a command for the system administrator; it is never used to send mail.)

Finally, I alluded earlier to your problems managing the Postfix service on macOS being that launchd, the system supervisor on Macs, does not manage Postfix in the same way as the postfix command, which is the way that other UNIX-like systems would normally use in their initialisation scripts. What you’re seeing is, in fact, a legitimate diagnosis of the state of play. You started the service, you monitored the service, and you stopped the service, and it did not die at any point in the meantime, as you showed. But the problem is that the way launchd starts the service is essentially to watch the queue directory where incoming mail is dropped, then start the server briefly for 60 seconds, during which time, it is supposed, mail will have been routed off the system, or remain in the queue for subsequent attempts at the next opportunity. This probably would actually be adequate for your purposes: you don’t need an SMTP server, only email submission via the sendmail binary and the maildrop queue, so you could probably get away with skipping the part of the guide that has you rewrite the file. This would save you a step, to be sure, but it would not provide quite the same level of service as an always-running system as described in the guide, which would continue to send email even if there were temporary delivery failures to Gmail. I imagine that when Apple made that choice, they quite reasonably expected that anyone who used this facility was probably mostly intending it for local delivery which would always succeed, and that if they needed remote deliveries, they would either be permanently connected to the Internet with a real system host name and resolvable address or would know how to configure the server to run permanently. Certainly I would not install a fresh copy of Postfix from MacPorts just to correct this particular “misfeature”, but it’s another complicating factor for you, and I hope it clarifies the mystery of your postfix output. Put simply, it pertains to the system you started, and not the system macOS starts.

I hope this clarifies some things for you. If you need help with specific steps, let us know.

1 Like

Sebby, thanks for your response. As you can imagine, I am more than willing to follow the simplest route possible to achieve my objective. That being the case, I am going to put the aforementioned method on hold, and give your approach a go instead.

But why oh why can’t webmaster life be more simple? :slight_smile: What I mean by that is that I have homebrew installed on both of my machines, and I haven’t used MacPorts in years. So, I type “brew install opensmtpd” in the terminal, and guess what? It is not available. So, I go to Homebrew’s online depository in my web browser, and guess what? It is NOT available.

So, please give me a few minutes while I install MacPorts on my server machine, and then install OpenSMTPD. Thanks.