[color green]
#!/bin/sh
#
# Purpose: Demonstrate how to send an email from UNIX using mailx.
############################################################ [/color]
[color green]# Example 1 - Simple:[/color]
echo "This is the body."| mailx -s "mailx Test1" jsmith@abc.com
[color green]# Example 2 - Using Variables:[/color]
SUBJECT="mailx Test2"
EMAIL_ADDRESS="jsmith@abc.com"
BODY="This is the body of the message."
[color green]# Example 3 - Attached File:[/color]
SUBJECT="mailx Test3"
EMAIL_ADDRESS="jsmith@abc.com"
BODY="This is the body of the message."
ATTACHED_FILE="/etc/hosts"
[color green]# Example 4 - Attached File to Windows Email:[/color]
SUBJECT="mailx Test4"
EMAIL_ADDRESS="jsmith@abc.com"
BODY="This is the body of the message."
ATTACHED_FILE_DIR="/etc/"
ATTACHED_FILE="hosts"
ATTACHED_FILE_AS="hosts.txt"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.