Linux ¿ÉÒÔÓöàÖÖ·½Ê½Í¨¹ýÃüÁîÐз¢Ë͵ç×ÓÓʼþ¡£ÓÐһЩ·½·¨Ê®·Ö¼òµ¥£¬ÓÐһЩÏà¶Ô»á¸´ÔÓһЩ£¬²»¹ýÈÔ¾ÉÌṩÁ˺ܶàÓÐÓõÄÌØÐÔ¡£Ñ¡ÔñÄÄÒ»ÖÖ·½Ê½È¡¾öÓÚÄãÏëҪʲô ¡ª¡ª ÏòͬÊ¿ìËÙ·¢ËÍÏûÏ¢£¬»¹ÊÇÏòÒ»ÅúÈËȺ·¢´øÓи½¼þµÄ¸ü¸´ÔÓµÄÐÅÏ¢¡£½ÓÏÂÀ´¿´Ò»¿´¼¸ÖÖ¿ÉÐз½°¸£º
mailÃüÁî
·¢ËÍÒ»Ìõ¼òµ¥ÏûÏ¢×î±ã½ÝµÄ Linux ÃüÁîÊÇ mail¡£¼ÙÉèÄãÐèÒªÌáÐÑÀÏ°åÄã½ñÌìµÃÔçµã×ߣ¬Äã¿ÉÒÔʹÓÃÕâÑùµÄÒ»ÌõÃüÁ
$ echo "Reminder: Leaving at 4 PM today" | mail -s "early departure" myboss
ÁíÒ»ÖÖ·½Ê½ÊÇ´ÓÒ»¸öÎļþÖÐÌáÈ¡³öÄãÏëÒª·¢Ë͵ÄÎı¾ÐÅÏ¢£º
$ mail -s "Reminder:Leaving early" myboss < reason4leaving
ÔÚÒÔÉÏÁ½ÖÖÇé¿öÖУ¬Ä㶼¿ÉÒÔͨ¹ý -s À´ÎªÓʼþÌí¼Ó±êÌâ¡£
sendmailÃüÁî
ʹÓà sendmail ÃüÁî¿ÉÒÔ·¢ËÍÒ»·â²»°üº¬±êÌâµÄ¿ìÐÅ¡££¨ÓÃÄ¿±êÊÕ¼þÈËÌæ»» recip£©£º
$ echo "leaving now" | sendmail recip
Äã¿ÉÒÔÓÃÕâÌõÃüÁî·¢ËÍÒ»ÌõÖ»ÓбêÌ⣬ûÓÐÄÚÈݵÄÐÅÏ¢£º
$ echo "Subject: leaving now" | sendmail recip
ÄãÒ²¿ÉÒÔÓà sendmail ·¢ËÍÒ»Ìõ°üº¬Ò»Ìõ±êÌâÐеÄÍêÕûÐÅÏ¢¡£²»¹ýʹÓÃÕâ¸ö·½·¨Ê±£¬ÄãµÄ±êÌâÐлᱻÌí¼Óµ½Òª·¢Ë͵ÄÎļþÖУ¬ÈçÏÂÀýËùʾ£º
Subject: Requested lyrics
I would just like to say that, in my opinion, longer hair and other flamboyant
affectations of appearance are nothing more ...
ÄãÒ²¿ÉÒÔ·¢ËÍÕâÑùµÄÎļþ£¨lyric Îļþ°üº¬±êÌâºÍÕýÎÄ£©£º
$ sendmail recip < lyrics
sendmain µÄÊä³öÒ²¿ÉÒÔºÜÈß³¤¡£Èç¹ûÄã¸Ðµ½ºÃÆ沢ϣÍû²é¿´·¢ËÍϵͳºÍ½ÓÊÕϵͳ֮¼äµÄ½»»¥£¬ÇëÌí¼Ó -v £¨verbose£©Ñ¡Ïî¡£
$ sendmail -v recip@emailsite.com < lyrics
muttÃüÁî
mutt ÊÇͨ¹ýÃüÁîÐз¢ËÍÓʼþµÄÒ»¸öºÜºÃµÄ¹¤¾ß£¬ÔÚʹÓÃÇ°ÄãÐèÒª°²×°Ëü¡£mutt µÄÒ»¸öºÜ·½±ãµÄÓÅÊƾÍÊÇËüÔÊÐíÄãÔÚÓʼþÖÐÌí¼Ó¸½¼þ¡£
ʹÓà mutt ·¢ËÍÒ»Ìõ¿ìËÙÐÅÏ¢£º
$ echo "Please check last night's backups" | mutt -s "backup check" recip
´ÓÎļþÖлñÈ¡ÄÚÈÝ£º
$ mutt -s "Agenda" recip < agenda
ʹÓà -a Ñ¡ÏîÔÚ mutt ÖÐÌí¼Ó¸½¼þ¡£ÄãÉõÖÁ¿ÉÒÔÌí¼Ó²»Ö¹Ò»¸ö¸½¼þ ¡ª¡ª ÈçÏÂÒ»ÌõÃüÁîËùʾ£º
$ mutt -s "Agenda" recip -a agenda -a speakers < msg
ÔÚÒÔÉϵÄÃüÁîÖУ¬msg Îļþ°üº¬ÁËÓʼþÖеÄÕýÎÄ¡£Èç¹ûÄãûÓÐÆäËû²¹³äµÄÄÚÈÝ£¬Äã¿ÉÒÔÕâÑùÀ´´úÌæ֮ǰµÄÃüÁ
$ echo "" | mutt -s "Agenda" recip -a agenda -a speakers
mutt ÁíÒ»¸öÓÐÓõŦÄÜÊÇ¿ÉÒÔÌí¼Ó³ËÍ£¨-c£©ºÍÃÜËÍ£¨-b£©¡£
$ mutt -s "Minutes from last meeting" recip@somesite.com -c myboss < mins
telnetÃüÁî
Èç¹ûÄãÏëÉîÈëÁ˽ⷢË͵ç×ÓÓʼþµÄϸ½Ú£¬Äã¿ÉÒÔʹÓà telnet À´½øÐеç×ÓÓʼþ½»»¥²Ù×÷¡£µ«ÕýÈçËù˵µÄÄÇÑù£¬ÄãÐèÒª¡°Ñ§Ï°ÊõÓ¡£Óʼþ·þÎñÆ÷ÆÚÍûһϵÁÐÃüÁÆäÖаüÀ¨×ÔÎÒ½éÉÜ£¨EHLO ÃüÁ¡¢Ìṩ·¢¼þÈË£¨MAIL FROM ÃüÁ¡¢Ö¸¶¨ÊÕ¼þÈË£¨RCPT TO ÃüÁ£¬È»ºóÌí¼ÓÏûÏ¢£¨DATA£©²¢ÒÔ . ½áÊøÏûÏ¢¡£²¢²»ÊÇËùÓеĵç×ÓÓʼþ·þÎñÆ÷¶¼»áÏìÓ¦ÕâЩÇëÇó¡£´Ë·½·¨Í¨³£½öÓÃÓÚ¹ÊÕÏÅųý¡£
$ telnet emailsite.org 25
Trying 192.168.0.12...
Connected to emailsite.
Escape character is '^]'.
220 localhost ESMTP Sendmail 8.15.2/8.15.2/Debian-12; Wed, 12 Jun 2019 16:32:13 -0400; (No UCE/UBE) logging access from: mysite(OK)-mysite [192.168.0.12]
EHLO mysite.org <== introduce yourself
250-localhost Hello mysite [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
MAIL FROM: me@mysite.org <== Ö¸¶¨·¢¼þÈË
250 2.1.0 shs@mysite.org... Sender ok
RCPT TO: recip <== Ö¸¶¨ÊÕ¼þÈË
250 2.1.5 recip... Recipient ok
DATA <== ÓʼþÄÚÈÝ¿ªÊ¼
354 Enter mail, end with "." on a line by itself
This is a test message. Please deliver it for me.
. <== ÄÚÈݽáÊø
250 2.0.0 x5CKWDds029287 Message accepted for delivery
quit <== ½áÊø½»»¥
Ïò¶à¸öÊÕ¼þÈË·¢Ë͵ç×ÓÓʼþ
Èç¹ûÄãÏ£Íûͨ¹ý Linux ÃüÁîÐÐÏòÒ»´ó×éÊÕ¼þÈË·¢Ë͵ç×ÓÓʼþ£¬Äã¿ÉÒÔʹÓÃÒ»¸öÑ»·À´°ïÖúÄãÍê³ÉÈÎÎñ£¬ÈçÏÂÃæÓ¦ÓÃÔÚ mutt ÖеÄÀý×Ó£º
$ for recip in `cat recips`
do
mutt -s "Minutes from May meeting" $recip < May_minutes
done