1. Information
Simple mail user agent
2. Linux
2.1. Installation
sudo apt-get install bsd-mailx
2.2. Usage
-
See https://www.johnkerl.org/doc/mail-how-to.html.
mail # Read emails. mail -f # Read old emails when there are no new emails. h # Show the current screenful of messages. h$ # Show the last screenful of messages.2024-06-03 17:58:52 smru@tbhf-anc-mrm ~$ echo "TEST 45" | mail -s "Test 45" "root@tbhf-anc-mrm.smru.shoklo-unit.com" # Something is not right. 2024-06-03 18:02:54 smru@tbhf-tst-mrm ~$ echo "TEST 49" | mail -s "Test 49" "root@tbhf-tst-mrm.smru.shoklo-unit.com" # Works, can read email using mail/mailx.# On smru@tbhf-tst-mrm. echo "TEST 59" | mail -s "Test 59" "smru@tbhf-tst-mrm.smru.shoklo-unit.com" grep -i "Test 59" ~delta/mbox echo p | mail > /dev/null # Print the first mail message in your default mailbox. grep -i "Test 59" ~delta/mbox
2.3. Test Emails
-
See Routing Exchange e-mail to internal Linux application server.
-
See Forward Exchange Online email to internal email server without MX record (Private internal domain).
-
See Set up connectors to route mail between Microsoft 365 or Office 365 and your own email servers.
# Send test email from remote servers to MS Exchange. ssh smru@tbhf-anc-mrm "echo | mail -s 'Test email from smru@tbhf-anc-mrm' smru-it@shoklo-unit.com" ssh smru@tbhf-ops-mrm "echo | mail -s 'Test email from smru@tbhf-ops-mrm' smru-it@shoklo-unit.com" ssh smru@tbhf-tst-mrm "echo | mail -s 'Test email from smru@tbhf-tst-mrm' smru-it@shoklo-unit.com" ssh smru@tbhf-anc-mkt "echo | mail -s 'Test email from smru@tbhf-anc-mkt' smru-it@shoklo-unit.com" ssh smru@tbhf-anc-wpa "echo | mail -s 'Test email from smru@tbhf-anc-wpa' smru-it@shoklo-unit.com" ssh smru@tbhf-anc-msl "echo | mail -s 'Test email from smru@tbhf-anc-msl' smru-it@shoklo-unit.com" ssh smru@tbhf-tst-mrm "echo TEST89 | mail -s Test89 smru@tbhf-tst-mrm.smru.shoklo-unit.com" # Check test email arrived. echo p | mail > /dev/null # Print the first mail message in your default mailbox. grep -i "Test89" ~delta/mbox