Method 1: send a simple email
Echo "Hello World" | mail-s "subject" yanggang_2050@163.com
Effect
Method 2: send an email in text format
#! /Bin/sh </P> <p> from_name = "from @ Yanggang" <br/> from = "yanggang@fruitsmobile.com" <br/> to = "yanggang_2050@163.com" </P> <p> email_title = "test mail" <br/> email_content = "/home/Barry/top800/test/output_email.html" <br/> email_subject = "top800_games_free_usa" </P> <p> echo-e ": \ "$ {email_title} \" <$ {to}> \ nfrom: \ "$ {from_name} \" <$ {from}> \ nsubject: $ {email_subject} \ n 'cat $ {email_content} '"|/usr/sbin/sendmail-TEffect:
Method 3: send emails in HTML Format
#! /Bin/sh </P> <p> from = 'anghang @ fruitsmobile.com '<br/> to = 'anghang _ 2050@163.com' </P> <p> email_date ='' <br/> email_content = '/home/Barry/top800/test/output_email.html' <br/> email_subject = 'top800 _ game_free_usa '</P> <p function> send_email () {<br/> email_date = $ (Date "+ % Y-% m-% d _ % H: % m: % s ") <br/> echo $ email_date </P> <p> email_subject = $ email_subject "_" $ email_date <br/> echo $ email_subject </P> <p> CAT $ email_content | formail-I "from: $ from "-I" mime-version: 1.0 "-I" Content-Type: text/html; charset = gb2312 "-I" Subject: $ email_subject "|/usr/sbin/sendmail-Oi $ to </P> <p >}</P> <p> send_emailEffect:
Download source code (send an email via Linux Shell)