Receive mail from any domain

I have a mail server whose domain name is "vrk.com" and a user named "vinod" in it...

All the mails send to "[email protected]" comes into the mail box /home/vinod/

Can i store mails addressed to "[email protected]" in this same mail box i.e /home/vinod/mbox...or into another catch all kind of user which catches all the up vote 1 mails regardless of the domain???? is it possible...i am using .... down vote favorite mail postfix asked Feb 4 '11 at 18:32

edited Feb 4 '11 at 18:52 shareimprove this question

Vinod K 1335

2 Answers active oldest votes You can't capture addressed to yahoo.com since Yahoo's MX records don't point to your server, so they'll never get routed through your postfix service.

If you're trying to create a catchall for a specific domain what you'll need to do is create a Virtual Domain file for postfix

sudoedit /etc/postfix/virtual up vote 0 In the virtual file add the following: down vote accepted @vrk.com vinod

Replace @vrk.com with the name of the domain you want to create the catch-all with (in your question this is where yahoo.com goes - however, as mentioned prior, you can't actually use yahoo.com as a valid domain since Yahoo's mail doesn't route to you) and the vinod part should be replaced with the username that the catch-all should go to.

Once you've created this file you'll need to encode it. That is done simply with the following:

postmap /etc/postfix/virtual

This does all the jazz (encoding, validating, etc) that Postfix needs in order to read it. To finish things up you'll want to add some lines to the configuration file and restart postfix

Open the configuration file with sudoedit /etc/postfix/main.cf and add this line to the bottom

virtual_alias_maps = hash:/etc/postfix/virtual

Then the restart with sudo service postfix restart!

answered Feb 4 '11 at 19:25

shareimprove this answer

Marco Ceppi♦ 19.9k1072121

he opened a separate question for which this is the correct and complete answer. you might want to repost it [here][1] [1]: askubuntu.com/questions/24883/… –

Call me V Feb 5 '11 at 4:36 In my case the mail server is local...not connected to internet...so yahoo.com would be just like any-other domain...right??....so it should work... – Vinod K Feb

5 '11 at 4:41 .its working....All the mails...from domains added in virtual file...like this "@yahoo.com root"....arrives....but not inn root mailbox but in nobodys mailbox....any idea why????..can i change it to make it come in root mail box??? or shall i create another user in the mail server and give it that mail box name?????...i think i did that with my mail box name i.e vinod....but only security mails were coming... – Vinod K Feb 5 '11 at 5:06

If you want to consolidate email from various POP3 accessible servers you can use the package to fetch the email and deliver it to your server. For freemail up vote 1 services like yahoo you will likely need to enable POP for the address you wish to down vote fetch. Documentation on configuring fetchmail will likely be in /usr/share/doc/fetchmail or by web at 'http://localhost/doc/fetchmail`. http://askubuntu.com/questions/24828/receive-mail-from-any-domain?rq=1 How to set up a mail server correctly? up vote 5 down I have read a number guides on setting up a mail server, but none of them vote favorite seems to work completely. 1 My Requirements:

 I want to send and receive mails to and from all domains. (i.e., yahoo,gmail,aol,etc.)  I only need real system users. Note:

 I am running Ubuntu server edition.

setup mail-server edited Nov 26 '12 at asked Jul 5 '11 at 15:52 15:43

shareimprove this

question

Jorge Castro karthick87 23.3k50222446 7,898958141

1 Answer active oldest votes Open a terminal and type sudo tasksel install mail-server

That will give you a fully functional mailserver with sane defaults. up vote 7 down For more information on how to setup a more customized solution, refer to the vote accepted Ubuntu Server Guide for 12.04:

 https://help.ubuntu.com/12.04/serverguide/email-services.html

How do you setup system email to send to a Gmail account? up vote 3 Often when I'm working on a terminal, I'll see the "you have new mail in..." down vote message. I know I can see this mail by looking in my system's mail folder, but this is favorite inconvenient. Also, if the message is important, such as a notice about low system 1 resources, or drive problems, or a failed cron job, I may not see that message or check the system's mail folder for weeks or more. How can I set it up so that all these messages get sent to a real email service, like Gmail, which I check daily?

email mail asked Aug 24 '11 at 13:26

shareimprove this question

Cerin 8243930

1 Answer active oldest votes See this:

Users can control their own mail delivery by specifying destinations in a file called .forward in their home directories.

So, when you do this:

echo "[email protected]" > ~/.forward up vote 2 down vote the mails should be forwarded to the e-mail you've specified (in this case, accepted [email protected])

answered Aug 24 '11 at 14:01

shareimprove this answer

Piskvor 60439

But you also need to be certain that the messages will be received. most IPs from residential ISPs from which email is sent from (i.e. the sending server 1 originates at a residential IP) get marked as spam and/or ignored by people. You may be able to make it work, but the issue is then dealing with spam. – The Lord of Time Aug 24 '11 at 14:43 @The Evil Phoenix: I'm not suggesting to send this mail to just some random guy out there - I have the forwarding set to my regular mail inbox, so that the 1 mail intended for me goes somewhere where I'll see it (I did whitelist the

equivalent of [email protected], but that's about it). On a side note, SMTP is a best-effort protocol - you can never be completely certain the messages will be delivered. – Piskvor Aug 24 '11 at 14:56 @The Evil One, This is my problem, as I get my internet through Comcast or Verizon. So getting to send email is easy. Getting sendmail to send 1 email and get it to reach the recipient is hard, because both Comcast and Verizon block outgoing email sent without authorization. – Cerin Sep 30 '11 at 18:32 On system's I've confirmed have working sendmail, adding ~/.forward doesn't seem to have any effect. – Cerin Oct 15 '11 at 14:54

How to configure mail (mailutils) to use schema by default?

When I type mail command, I get a "No mail for USER" answer, but there's indeed mail (it's in /home/USER/Maildir/new)

I guess it has something to do with the mailbox being in Maildir format, instead of mbox, but I don't know how to tell mailutils (specifically the mail command) which format to use. up vote 2 down vote mail favorite asked Feb 14 '11 at 12:33

edited Feb 14 '11 at 13:36 shareimprove this question

luri 1,760927

1 Answer active oldest votes Afaik "mail" utility checks mails at the location given with the MAIL environment variable. Try this command: MAIL=/home/USER/Maildir/ mail (for sure, replace USER with something meaningful & valid). If that works, it seems that you should set MAIL variable you can do it in your bash profile / rc file for example. You can check up vote the content of your current MAIL variable with: echo $MAIL 3 down vote answered Feb 14 '11 at 13:04 edited Feb 14 '11 at 13:13

shareimprove this answer

LGB 1,07439

I did not say nautilus, but mailutils (similar, tho :) ) – luri Feb 14 '11 at 13:08

Arghhh, I haven't slept too much, I must admit :) Okei, and sorry for the misread, however what I told (the other parts than nautilus, hehe) is still valid. But after this

nasty mistake, I am not sure anymore :-@ – LGB Feb 14 '11 at 13:12 OK... if I set MAIL=/home/USER/Maildir/ mail, I get the right number of mails, and I can read them... BUT upon reading mails, 'mail' command will move them from /home/USER/Maildir to /home/USER/mbox.... wich doesn't exist, so, as a matter of fact, it did erase them (just test mails, so no worries). But shouldn't it realize where and how mail is stored (btw I have postfix and courier working). – luri Feb 14 '11 at 13:14 Update: my bad, it does not move mail to /home/USER/mbox folder. It's a file, that contains the mails in text format... But anyway it renders them unusable for Courier,

that seeks a Maildir schema. – luri Feb 14 '11 at 13:42 "text file format"? Then it's the "standard" " mailbox" file format, which is just one file (as opposite to the maildir) containing every mails. But I am not sure now, if you write that "it does not move mails" then what's the problem, if mails were not moved, your mails are still in your maildir (/home/USER/Maildir), isn't it? Or have you missed check /home/USER/Maildir/cur/ ? Maildir has cur/ and new/, new contains the unread mails, cur the read ones. Maybe "mail" utility moved your mails into /cur, since they are not new anymore. That is the good behavior, maildir works this way! – LGB Feb 14 '11 at 13:50 They aren't in either Maidir/new or Maildir/cur.... they're deleted from there (not just moved from and written to the 'mailbox file', where courier can't access them. The issue is, then, if there is a configuration file for mailutils where I can set up 'mail' command to use Maildir schema by default, not having to set the MAIL environment

variable (which would be a minor problem, anyway), and avoiding the erasing (well, erasing in practice for me, though they're really moved to an 'mbox' mailbox) of read mails. – luri Feb 14 '11 at 22:34 I would add the global variable as MAIL = ~/Maildir – LinuxBill Mar 6 at 14:47

How can I access system mail in /var/mail/ via thunderbird?

I've got cron jobs sending mail to my user at /var/mail. I know how to access that at the command line with the mail command. But, while a big command line fan, I up vote 6 do not like reading mail (even system mail) that way. down vote favorite My mail client of choice is Thunderbird. Can I read /var/mail messages in 2 Thunderbird? How? I'm running Ubuntu 9.04 and Thunderbird 2.0.0.24 (though I'm soon to upgraded to 10.04).

thunderbird system mail edited Aug 15 '12 at 6:37 asked Aug 11 '10 at 3:44

shareimprove this question

Mitch vanden 16.8k62653 435617

1 Answer active oldest votes In Ubuntu 10.04, with Thunderbird 3, the option is accomplished by:

1. Select Edit, Account Settings

up vote 9 down vote accepted

2. Choose Account Actions, Add other account

3. Select Unix Spool (Movemail).

The UI to access this menu is slightly different in Thunderbird 2, but I didn't have it handy.

In Thunderbird 2, do the following, adapted from the Gmail FAQ:

1. Click the Tools menu, and select Account Settings.. 2. Click the Add Account... button to launch Account Wizard. 3. Select Movemail from the list.

answered Aug 11 '10 at 4:22

shareimprove this answer

lfaraone 2,7801023

Well, now I feel foolish. (I'd tried some time ago and hope that the option in the wizard post-dates that, else I don't know how I missed it!) Thanks. It was also 1 necessary to run sudo chmod 01777 /var/mail to get this to work, as without,

thunderbird complained it couldn't write a ~.lock file. – vanden Aug 11 '10 at 12:33 @vanden: You should find a lower permission that works or create a group that 1 allows access. World writeable is dangerous. – Dennis Williamson Aug 11 '10 at 17:05 @Dennis: Thanks. I wasn't pleased by the permissions, either. They were suggested by the thunderbird interface. I tried removing world write access, but 1 that prevented access to the mail. Having fetched the backlog, I've reverted. – vanden Aug 11 '10 at 20:14

How are administrators supposed to read root's mail?

What is the Ubuntu way for system administrators to receive system notifications, which typically take the form of e-mail sent to the root account?

Examples of such notifications are the output of cron jobs, or degraded RAID notifications.

On a pretty much default Ubuntu 10.04 installation, I can't find any way that up vote 25 anything happens to root's mail other than being deposited in /var/mail/root. How down vote are users supposed to 1. discover it and 2. read it as it arrives? favorite 10 I observe that on a warty, the installer added root: myusername to /etc/aliases. So back then the user who installed the system if (s)he read the local mail. So there seems to have been a regression somewhere along the way. Still this was not a complete solution, because Ubuntu users can't be expected to be aware that they have local mail and should set up their mail client to read it.

ADDED: given current replies, a server user should be able to cope, provided he's aware of the issue. Fair enough. But consider J. Random Desktop User, who doesn't know how to use a command line, and only knows how to click the mailbox icon to read his mail. How can he be notified that his system wants to tell him something? (Allow a one-time intervention by a more competent user if that's unavoidable.)

mail administration root cron-jobs asked Aug 14 '10 at 11:43

edited Aug 14 '10 at 18:16 shareimprove this question

Gilles 14k33165

I managed to get KMail to read my local mail using some very strange hacks I 1 found, but since the update to 11.10 I'm lost – Dirk Hartzer Waldeck Nov 17 '11 at 14:48 I recently did a long tutorial on this very subject, although relating to Thunderbird: see askubuntu.com/questions/192572/… – Mik Oct 30 '12 at

23:45 @Mik That, with a little something about installing postfix at the top, would make a nice answer here. – Gilles Oct 30 '12 at 23:48 @Gilles Thanks, although I probably would have to shorten or delete the answer at the other question, so there wouldn't be duplication. – Mik Oct 30 '12 at 23:53 @Mik No, it would be fine to repost substantially the same answer (not exactly, since here you'd need to start by installing an MTA). The questions aren't duplicate: there are answers here that wouldn't work on the other question and

vice versa. It does happen that sometimes 90% of an answer can be recycled for another question, that's fine. – Gilles Oct 30 '12 at 23:56 @Gilles Ah, I see, thanks for clarifying the point. – Mik Oct 30 '12 at 23:59

4 Answers active oldest votes Encouraged in the comments by Gilles, I have adapted and expanded another answer: up  How read local email in thunderbird? vote 10 (I am running Ubuntu 12.04.1 LTS, but the general setup process should apply to previous dow and future Ubuntus) n vote acce pted The first thing to do is to install a Mail Transfer Agent (MTA) so the mail can be relayed +100 to a mail User Agent (MUA) such as Thunderbird. This is only necessary because we are dealing with local mail and want to be able to send and receive it; with normal remote gmail type accounts, only a user agent such as Thunderbird is necessary.

I use postfix, which itself is an alternative to sendmail, of which there are commercial and open source versions. More information about postfix's capabilities is at the official site and users may find that the mailing lists contain useful information if any issues arise.

So, to install the program, run sudo apt-get install postfix

You can either configure it when it is installed, or decline the offer and later run sudo dpkg-reconfigure postfix to create the important config file (/etc/main.cfg). If you ever manually edit this file, which is not necessarily recommended, you must run sudo newaliases and sudo service postfix restart afterwards to apply the changes.

Postfix is pretty straightforward to setup, although you may have some particular settings that you wish to apply. In the first screen you see below, you must choose the local option for your mail:

Then on the next screen choose your 'mail name'; it is usually the same as /etc/hostname. You can accept the defaults for most of the following screens.

When it mentions /etc/aliases and the Root and Postmaster recipient (as above), you can fill in your user name, but make sure you check your aliases file is as it should be by reading the next section of this tutorial.

First, as also recommended in this discussion, your /etc/aliases should be like this if it is setup correctly: postmaster: root root: mike

If not, edit it with sudo nano /etc/aliases, and then run sudo newaliases and sudo service postfix restart so that the configuration is updated. Postfix's aliases feature allows mail to be redirected, so the setup is very important for the rest of this tutorial. As also noted in the above link, you need to create a .forward file containing your username and localhost: e.g. mike@localhost so that root's mail will be forwarded to you. To do this, enter these commands: sudo touch /root/.forward and then run sudo nano /root/.forward to place your user: e.g. mike@localhost in the file and save it.

In addition, I found it was necessary to add your user to the mail group so that Thunderbird could access the mail files: sudo adduser $USER mail and then logout and login for the changes to take effect. There is no need to chown or chmod any files, as some articles might suggest, and adding your user to the mail group is much better practice and avoids any direct changing of the permissions on the root filesystem.

Now for the Thunderbird configuration. Go to edit > account settings > account actions > add other account > select Unix spoolmail and in the next screen put your username in the first box and place yourusername@localhost in the second box.

Now, go to your new account in account settings and select server settings and select the local directory as /var/mail or /var/mail/username (if setup), as in the screenshot below.

As per the instructions in this article you will need to configure the smtp server if you want to test the account by sending a mail to root@localhost and then clicking get mail in Thunderbird to receive it, as root's mail is being redirected to youruser@localhost.

Go to account settings > outgoing server and choose to add a new one. The settings should be as in the screenshot below:

Now, finally test your account by composing a mail to root@localhost and then a few seconds later clicking get mail on your account. You should see an email like this:

Some programs or logs will need to be configured so that they send mail to root, but that can be decided as you find the need. This article should hopefully be useful as it is not always straightforward to set up Thunderbird to receive local mail.

answered Oct 31 '12 at 1:08

edited Oct 31 '12 at 1:50

shareimprove this answer

Mik 12.4k32355

If this is a server I would strongly suggest you alias root to a real email address so you get your email delivered to your administrators It is as easy as adding

# Person who should get root's mail root: [email protected]

to the end of /etc/aliases up vote Alternatively you can configure mail to be aliased to your local username and then when 14 you log in you will get the message "You have mail", which you can check using the down mail command or by installing pine / / or something similar on that server.. vote answered Aug 14 '10 at 12:55

shareimprove this answer

Richard Holloway 7,2531741

Thanks, that's a good enough explanation for a server admin, I suppose. But how do I explain this to J. Random desktop user, who is definitely not going to use the 1 command line, but would like to know if his disks are failing? – Gilles Aug 14 '10 at 18:09 You question starts: "What is the Ubuntu way for system administrators to receive system notifications...". But anyway, for desktop users, to keep an eye on the system messages they could use gnome-system-log to view logs (which is already installed 1 on a default Ubuntu Desktop as part of gnome-utils package) or add "root: username" to the end of /etc/aliases. I agree this a weak solution and perhaps a bug should be raised to get this feature added back in as there is no GUI way to do this on a default Ubuntu install. – Richard Holloway Aug 15 '10 at 22:02 The alias for server admins is best. You could also sudo su - then use a CLI client. But if your seriously admining a box, make the alias. Normal users don't need to see this mail. They have other means for notification messages. If they want to, then

they can create the alias. It makes perfect sense for this to be off by default. – coteyr Nov 4 '12 at 20:09

I am personaly using a mailer agent called nullmailer. It acts as a mail proxy, and transfers all mails sent to root to a mail address of your choice. up vote 6 You need to set its settings in conf files under /etc/nullmailer. Basically : give it your mail down porvider address and credentials, and the adress you want to receive the root emails on. vote You can install it with

sudo apt-get install nullmailer You can get more information on its setup here : http://jviz.research.iat.sfu.ca/wiki/index.php?title=HOWTO_Setup_Nullmailer

answered Aug 14 '10 at 12:54

edited Aug 14 '10 at 16:08

shareimprove this answer

Little Jawa 1,6282815

+1 thanks for the link (and the teeny MTA concept embodied therein) – msw Aug 14 '10 at 14:45

Currently there is no notification to the user that a root local mailbox even exists, because user != root If you needed to check the mailbox you could type the following: sudo mail to launch the mail application under root.

You could also log in as root on that server. To unlock the root password simply type: up sudo passwd and enter a new password for root. vote 2 down answered Aug 14 '10 at 12:25 vote

shareimprove this answer

Marco Ceppi♦ 19.9k1072121

With a test user in 10.04 using the the default gnome-based interface, or the default kde-based interface, or the default lxde-based interface, I don't see any kind of 1 notification that there is something in /var/mail/$USER either. – Gilles Aug 14 '10 at 18:11

can't compact mail folder /var/mail/username

ubuntu 11.10 32bit. Setup a dovecot imap server. Using Thunderbird on a different ubuntu machine (64bit) to access imap server. Everything else is fine, except I can up vote 0 not compact the deleted email in inbox, which is stored at /var/mail/username. down vote Checking mail.log and I see this error message: favorite 1 Apr 3 00:10:11 autumn dovecot: imap(username): Error: file_dotlock_create(/var/mail/username) failed: Permission denied (euid=1000(username) egid=1000(username) missing +w perm: /var/mail, euid is not dir owner) (set mail_privileged_group=mail)

what is wrong with the permission? Here are the permissions for the relevant files:

$ ls -ld /var/mail drwxrwsr-x 2 mail mail 4096 2012-04-02 23:36 /var/mail

$ ls -l /var/mail/username -rw------1 username mail 417 2012-04-02 23:36 /var/mail/username

Anyone knows what's going on here?

permissions mail dovecot asked Apr 3 '12 at 4:27

shareimprove this question

G. He 315514

I went into /etc/dovecot/conf.d/10-mail.conf, added the group mail to the line 1 "mail_privileged_group = ", stop dovecot, and then start dovecot. It works now. Although I wish this was documented somewhere. – G. He Apr 3 '12 at 11:56 It is documented here. Please convert your comment to an answer and accept it so that this question is not left hanging without an answer. – Celada Apr 4 '12 at

16:26

1 Answer active oldest votes I went into /etc/dovecot/conf.d/10-mail.conf, added the group mail to the line "mail_privileged_group = ", stop dovecot, and then start dovecot. It works up vote 0 down now. vote accepted As pointed out by Celada, it is documented here.

Cara Cepat Menghapus Isi Mailbox User Tertentu pada Zimbra Mail Server

Written by Masim Vavai Sugianto Migrasi Server, openSUSE & SLES, RedHat Family, Tips, Tricks & Tutorial, Ubuntu Family Oct 15, 2010 Print

Pada kondisi tertentu, ada kalanya kita ingin mengosongkan isi suatu mailbox di Zimbra Mail Server, misalnya isi mailbox admin yang terlalu penuh karena dijadikan tempat penampungan sementara . Seorang admin biasanya memiliki 1 email tertentu yang dijadikan sebagai mailbox testing, meski tidak semua admin berperilaku demikian (Admin juga manusia, bisa sama bisa beda, hehehe…).

Menghapus isi email melalui webmail akan membutuhkan waktu, apalagi jika kapasitasnya sudah > 1 GB yang berarti ada sekian ribu atau puluh ribu email. Tangan bisa kesemutan kalau harus berpindah dari page ke page hanya untuk menghapus isi mailbox yang terlampau besar.

Zimbra menyediakan CLI (Command Line Interface) yang bisa digunakan untuk melakukan hal ini. Perintahnya juga sangat mudah dipahami, yaitu : view sourceprint? 1.su - zimbra 2.zmmailbox -z -m [email protected] emptyFolder /Inbox

Kita bisa mengganti [email protected] dengan account yang kita inginkan dan /Inbox dengan folder yang diinginkan. Harap berhati-hati jangan menyalahgunakan perintah ini karena email yang terhapus tidak dapat dikembalikan lagi. Lakukan dengan cermat dan hati-hati.

How do I delete thousands of e-mail messages with cPanel or Horde's webmail interface?

Answer: How do I delete thousands of e-mail messages with cPanel or Horde's webmail interface?

If you run a website, you may find out one day that you have a mail account containing thousands of messages — or possibly even hundreds of thousands. The most common reason this happens is because the default e-mail account is set up as a "catch-all" address. This will direct all e-mail sent to invalid usernames at your domain to the default Inbox. Because spammers send out spam messages to invalid e-mail addresses all the time, the number of e-mails received by the default mailbox can grow by thousands of messages each day.

The best solution to this problem is to prevent it. If you have a Web server that is running cPanel, you can turn off the "catch-all" address by selecting the "Default Address" panel within the Mail section of the cPanel interface. Then choose the option that says "Discard with error to sender (at SMTP time)." This will bounce all invalid e-mails back to the sender and will keep the messages from piling up in your default mailbox. Over time, this can help save a lot of hard disk space on your server.

Of course, if you're like me, you caught this problem after thousands of messages had already filled your default e-mail account's Inbox. In my case it was over 500,000 messages. I realized that deleting these messages one page at a time via the Horde webmail interface would take awhile (as in several days). So I figured there must be some easier way to delete the messages. Fortunately, after doing some research, I found that there is indeed a simple way to remove all the messages in the Inbox.

Just follow these basic steps:

1. Log into the Horde Mail system. 2. Click the "Folders" icon at the top of the window. 3. Check the box next to "Inbox" or the mailbox that contains the messages you want to delete. 4. From the "Choose Action:" drop-down menu, select "Empty Folder(s)." 5. You will be prompted to confirm the action, as it is not undoable. 6. Click "Empty Selected Folders" to clean out the mailbox.

Depending on how many messages are stored in your Inbox, this operation may take a few seconds to several minutes to complete. The only catch is that if the mailbox contains too many messages, the operation will time out and will not empty the mailbox. This is what happened to me with my 500,000+ messages.

If this is also your situation, you may have to delete the message folders manually. To do this, you will first need to navigate to the mail folder, which is located in the following directory:

/home/username/mail/ (where "username" is the username for the mail account)

The two folders you'll need to delete are the cur and new folders, which contain the messages. You may be able to do this with an SSH or SFTP program, though I also had problems with this method timing out. If you know some basic Unix commands, you can use a terminal (command- line) program to manually delete the folders. First navigate to the mail folder, then recursively delete the cur and new directories. The commands to do this are:

$ cd /home/username/mail $ rm -rf cur $ rm -rf new

Again, even this method may take awhile if the directories are loaded with thousands of mail messages. But it should eventually remove the folders. This command-line method should only be used a last resort, as the maildirsize file will no longer contain the correct information for the mail account. Fortunately, as soon as a new message is received into the empty Inbox, the cur and new folders are automatically recreated and the maildirsize is updated with the correct data.

If you have been wondering how to delete a large number of messages stored on your mail sever, I hope this information is helpful and saves you a lot of time. How To Delete Mails From Or To A Specific Email Address From Your Mail Queue (Postfix)

Version 1.0 Author: Falko Timme Last edited 01/04/2008

If you get hit by a spam attack that floods your server with hundreds/thousands of emails from the same sender email address or to the same recipient email address, you can clean your mail queue from these emails with one single command before the mail flood takes your server to its knees.

You can check your current mail queue like this: postqueue -p

To delete all mails from the mail queue that come from [email protected] or are sent to [email protected] (the command is the same regardless of if it's the sender or recipient address), you can use this command: mailq | tail +2 | awk 'BEGIN { RS = "" } / falko@example\.com$/ { print $1 }' | tr -d '*!' | postsuper -d -

Afterwards check your mail queue again: postqueue -p

It should now be much shorter.