Send email to blackhole

Need to send a bunch of emails to blackhole or /dev/null while sending them out via the command line mail applications in linux?

The following is how you can get that done.

You need to create a new alias in /etc/aliases file. Edit the file:

[[email protected] ~]# vim /etc/aliases

And add the following line

blackhole:   /dev/null

Save and exit the file.

Run the following command

[[email protected] ~]# newaliases

Now you have a user, blackhole which is aliased to /dev/null. You can try sending the email to this user via the command line, as given below:

[[email protected] ~]# echo “hey, how are you doing?” | mail -s “mail” blackhole

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.