Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a quick question. How does one add emails to Postfix's queue without it delivering the emails? I am writing a script to email Postfix statistics (queue count, sent, etc) to our support staff. I want to test it when there are emails in Postfix's queue to see if its working correctly. However, every time I send an email from Postfix it gets delivered. :)

Thanks!

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

Some methods:

  • Use @EightBitTony's approach
  • Use a VM for development and pull the virtual plug to the network
  • Use a firewall rule to drop outgoing packets for port 25.

and the best way:

share|improve this answer
1  
That is the best way to prevent delivery to a destination, yes. To prevent delivery in general, stop the smtp(8) daemon. –  adaptr May 24 '12 at 9:55
add comment

Send it to a valid hostname in a domain you own, that you know doesn't run an smtp server. For example, if you own server.domain.example and you know it's not running an smtp server, send them mail to bob@server.domain.example.

Postfix will queue it while it tries to talk to the target smtp server.

This assumes you've not configured postfix to send all mail to another relay, but to deliver directly.

And I'm sure there's a better way, to tell postfix to pause delivery, but hey, there's strength in variation.

share|improve this answer
    
The canonical way to prevent delivery is to stop the smtp(8) daemon by including the following in main.cf: master_service_disable = smtp –  adaptr May 24 '12 at 9:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.