How To Send Email

Hi, My name is Jimmy Sam. If you need DBA help, please email to jimmy_sam001@yahoo.com for further discussion. Thanks.

top   prev   next  

Unix Email

#using mail
echo "test for oncall switch"|mail  -s "OnCall Switch test" xxx.yyy@zzz.com
mail  -s "OnCall Switch test" xxx.yyy@zzz.com<my_file.txt

#using mailx
echo "test for oncall switch"|mailx -s "OnCall Switch test" xxx.yyy@zzz.com
mailx -s "OnCall Switch test" xxx.yyy@zzz.com<my_file.txt

# put from address for iphone vip alert
echo "mydb orcl has space issue"|mailx -r iphone_alert_vip@ccc.com -s "mydb space issue" aaa.bbb@ccc.com

#send attachment
1):
( echo "My Text Message" ; uuencode Test.dat Test.dat ) | mailx -s 'Testing' xxx.yyy@zzz.com
( cat mesgfile ; uuencode Test.dat Test.dat ) | mailx -s 'Testing' xxx.yyy@zzz.com

#note 1: The following will not working, if pipe and input file together, input file takes preference
uuencode Test.dat Test.dat| mailx -s 'Testing' xxx.yyy@zzz.com < MESGFILE

#note 2: The following will work
uuencode attachfile attachfile
cat mesgfile attachfile > combo
mailx -s "Test Subject" mymail@yahoo.com < combo

2):
(echo From: xxx yyy [xxx.yyy@zzz.com]; echo Subject: Testing ; echo To: My friends; cat messagefile ; uuencode -m attach.file1 attachname1 ; uuencode -m attach.file2 attachname2 ) | sendmail `cat recipients-list`

#'EOF', not instantiate $var
cat <<'EOF' - "test.html"| /usr/sbin/sendmail -t
To: xxx.yyy@zzz.com
From: xxx.yyy@zzz.com
Subject: My HTML Docs
Content-Type: text/html

EOF

#EOF, instantiate $var
TO_EMAIL_ADDR=xxx.yyy@zzz.com
FROM_EMAIL_ADDR=xxx.yyy@zzz.com
EMAIL_SUBJECT="This is My HTML Docs From Command Line"
EMAIL_HTML_FILE="test.html"
cat <<EOF - ${EMAIL_HTML_FILE}| /usr/sbin/sendmail -t
To: ${TO_EMAIL_ADDR}
From: ${FROM_EMAIL_ADDR}
Subject: My HTML Docs
Content-Type: text/html

EOF

windows powershell:
send-mailmessage -to "xxx.yyy@zzz.com" -from "xxx.yyy@zzz.com" -subject "Test mail" -Body "This is A Test" -smtpServer 'forwarder.zzz.com'

send-mailmessage -to "xxx.yyy@zzz.com" -from "xxx.yyy@zzz.com" -subject "Test mail" -Body "This is A Test" -smtpServer 'forwarder.zzz.com'