MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
September
Sun Mon Tue Wed Thu Fri Sat
       
27  
2016
Months
Sep


Tue, Sep 27, 2016 11:05 pm

Daily testing of email deliveries using mailx

I needed a way to perform a daily check that a Linux email server is able to successfully transmit email to external email addresses. Such a test can easily be scheduled using cron and mailx. You can use the crontab utility to schedule mailx to run periodically and send a test message to a specified email address. E.g., the following entry will send a test message at five minutes after noon every day to john.doe@example.com:

05 12 * * * mailx -s "Daily email delivery test" john.doe@example.com </home/jan/Documents/daily_mail_test_message.txt

The body of the message will contain the contents of the file /home/jan/Documents/daily_mail_test_message.txt.

The first 5 elements on the line in the crontab file are scheduling elements:

 # ┌───────────── min (0 - 59)
 # │ ┌────────────── hour (0 - 23)
 # │ │ ┌─────────────── day of month (1 - 31)
 # │ │ │ ┌──────────────── month (1 - 12)
 # │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to
 # │ │ │ │ │                  Saturday, or use names; 7 is also Sunday)
 # │ │ │ │ │
 # │ │ │ │ │
 # * * * * *  command to execute

If an asterisk is used for an element, that indicates that scheduling is done for every possible value for that element. E.g., the 05 on the line indicates five minutes after the hour, in this case 12 (noon) and the following three asterisks indicate that the cron job should be run every day of every month and every day of the week, i.e., Sunday to Saturday.

[ More Info ]

[/network/email/mailx] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo