How to flush the mail queue of postfix

Hello,
say my MacBook is offline and I do something like:
$ echo hello | mail -s Hello somebody@somewhere.com

The mail can't be sent immediately so it will be stored in postfix' mail queue for later delivery. How can I force postfix to attempt delivery?

$ sudo mailq Password:
postqueue: warning: Mail system is down -- accessing queue directly
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
53FAA957869 4800 Thu Aug 2 22:30:35 tsuna@tsunaxbook2.local
(Host or domain name not found. Name service error for name=somewhere.com type=MX: Host not found, try again)
. somebody@somewhere.com
[...]
-- 44 Kbytes in 4 Requests.

According to man 1 postqueue, running postqueue -f should do what I want, but:
$ sudo postqueue -f
Password:
postqueue: fatal: Cannot flush mail queue - mail system is down

Thanks.

edit: how do I turn of the formatting done by the forum or get fixed-width fonts? Like [ + ... + ] makes a link and -- + -- strikes out the text.

MacBook C2D 2Ghz 2G DDR, Mac OS X (10.4.10)

Posted on Aug 6, 2007 1:33 AM

Reply
2 replies

Aug 6, 2007 6:13 AM in response to tsuna

Hi--

Try this:

<pre class="command">sudo postfix flush</pre>

I found a hint at Mac OS X Hints that said that would work, as it starts the mail system temporarily if it's down. I can't test it here, since I have enabled postfix for delivering mail.

If you finally decide the message is not deliverable, try this to delete all the undelivered mail in the queue:

<pre class="command">sudo postsuper -d ALL</pre>

Otherwise, you could also use the queue ID from mailq to delete individual emails.

As for formatting, try surrounding your code with {code}, that's really it, the word "code" surrounded by curly brackets. Don't use a "/" in the close tag, either. That seems to be the safest for right now.

I get the greyed out background by using the "pre" HTML tag, with a class of "command": <pre class="command">. But the board software still translates some stuff in that, and adds two or three lines of spacing if it's multiple lines.

Apple's aware of it and working on it...

charlie

Aug 6, 2007 7:30 AM in response to Charles Minow

$ sudo postfix flush
postqueue: fatal: Cannot flush mail queue - mail system is down

The command returns 69.
I found how to start postfix properly on the forum:
<pre class="command">sudo launchctl start org.postfix.master</pre>
Then postfix flush did not complain anymore but the mails are still there in the mail queue with a message saying (Host or domain name not found. Name service error for name=tsunaxbook2.local type=MX: Host not found, try again) ( tsunaxbook2 is the hostname of my MacBook).

Another mail in the mail queue says:
host smtp2.*hidden*.com[162.*.*.*] said: 451-82.*.*.* is not yet authorized to deliver mail from to 451 <tsuna@**.fr>. Please try later. (in reply to end of DATA command)
That's weird because now that I'm online, I can send a mail to tsuna@**.fr by using echo test | mail -s test tsuna@**.fr. What looks weird in this message is the deliver mail from <> part.

By the way, thanks for the tips, <span class="command"> gives better results and does not add extra lines (because \n is already enough to start a new line in <pre> and the board adds <br /> at the end of each line).

The board is also annoying because it transforms [...] in links and seems to remove *. The solution I found is to encode them with &#ASCII-CODE; (eg: &#42; for * and &#91; for [)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to flush the mail queue of postfix

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.