发送邮件客户端: 

Msmtp是一款专门负责邮件发送的客户端软件,基于GPL发布。支持TLS/SSL、DNS模式、IPv6、服务器端认证、多用户等特性。

邮件打包:

Msmtp - Ubuntu编译 

./configure --sysconfdir=/etc  make  make install

Msmtp - 配置

  • 编译的时候加上了--sysconfdir=/etc,那么全局的配置文件就在/etc下面,名为Msmtprc,

    • 也可以 msmtp -C msmtprc 指定配置文件

    • 如果直接 ./configure 编译时,".msmtprc" 为用户目录(~/) 是 "/usr/local/etc/msmtprc" 

  • 配置,得去 163 上注册个邮箱 

account defaulthost smtp.163.com  #发送的邮件服务器port 25  #端口号from ****@@163.com #用于发送的邮箱auth logintls offuser ****@163.com  #邮箱用户名password ***       #邮箱密码,这里可是明文的,如果你觉得不安全可以把文件改为600属性logfile /var/log/mmlog   #日志文件

Msmtp -测试 

msmtp -t   # -t 指定收件人  msmtp 是接收键盘输入to: ****@qq.com  # 收件人subject: 邮件测试  # 主题#空行这是邮件内容#ctrl+d 结束msmtp: log info was: host=smtp.163.com tls=off auth=on user=****@163.com from=****@163.com recipients=****@qq.com mailsize=125 smtpstatus=250 smtpmsg='250 2.0.0 OK 0844c3e6-3f85-4946-b33c-bac1bbfd1b96' exitcode=EX_OK

Msmtp -调试(-d)

msmtp -d -t   to: ****@qq.comsubject: 邮件测试 ignoring system configuration file /usr/local/etc/msmtprc: No such file or directoryloaded user configuration file /home/****/.msmtprcfalling back to default accountusing account default from /home/****/.msmtprchost                  = smtp.163.comport                  = 25timeout               = offprotocol              = smtpdomain                = localhostauth                  = LOGINuser                  = ****@163.compassword              = *passwordeval          = (not set)ntlmdomain            = (not set)tls                   = offtls_starttls          = ontls_trust_file        = (not set)tls_crl_file          = (not set)tls_fingerprint       = (not set)tls_key_file          = (not set)tls_cert_file         = (not set)tls_certcheck         = ontls_force_sslv3       = offtls_min_dh_prime_bits = (not set)tls_priorities        = (not set)auto_from             = offmaildomain            = (not set)from                  = ****@163.comdsn_notify            = (not set)dsn_return            = (not set)keepbcc               = offlogfile               = /var/log/mmlogsyslog                = (not set)aliases               = (not set)reading recipients from the command line and the mail<-- 220 hz-b-163smtp2.163.com SMTP Server for Netease [466] 25c8afc4-d57e-4c39-8409-1679ff504de2--> EHLO localhost<-- 250-hz-b-163smtp2.163.com<-- 250-mail<-- 250-PIPELINING<-- 250-8BITMIME<-- 250-AUTH LOGIN PLAIN<-- 250-AUTH=LOGIN PLAIN<-- 250 STARTTLS 25c8afc4-d57e-4c39-8409-1679ff504de2--> AUTH LOGIN<-- 334 VXNlcm5hbWU6 25c8afc4-d57e-4c39-8409-1679ff504de2--> enFlY2dfbWFpbEAxNjMuY29t<-- 334 UGFzc3dvcmQ6 25c8afc4-d57e-4c39-8409-1679ff504de2--> YWJjZC4xMjM0<-- 235 OK, go ahead (#2.0.0) 25c8afc4-d57e-4c39-8409-1679ff504de2--> MAIL FROM:<****@163.com>--> RCPT TO:<****@qq.com>--> DATA<-- 250 2.0.0 OK 25c8afc4-d57e-4c39-8409-1679ff504de2<-- 250 2.0.0 OK 25c8afc4-d57e-4c39-8409-1679ff504de2<-- 354 Start mail input; end with 
.
 25c8afc4-d57e-4c39-8409-1679ff504de2--> to: ****@qq.com--> subject: 邮件测试 --> --> --> 这是邮件内容--> 这是邮件内容--> --> --> --> .<-- 250 2.0.0 OK 25c8afc4-d57e-4c39-8409-1679ff504de2--> QUIT<-- 221 2.0.0 Bye 25c8afc4-d57e-4c39-8409-1679ff504de2msmtp: cannot log to /var/log/mmlog: cannot open: Permission deniedmsmtp: log info was: host=smtp.163.com tls=off auth=on user=****@163.com from=****@163.com recipients=****@qq.com mailsize=66 smtpstatus=250 smtpmsg='250 2.0.0 OK 25c8afc4-d57e-4c39-8409-1679ff504de2' exitcode=EX_OK

Msmtp -应用

 ./msmtp -C msmtprc  -t < mail.txt   # -C 指定 msmtp 的配置文件cat ./mail.txtto: ***@qq.comsubject: 主题内容...


Mutt - Ubuntu编译 

./configure --sysconfdir=/etc  make  make install

Mutt - 配置

cat /etc/Muttrcset sendmail="/usr/local/bin/msmtp"set from="****_mail@163.com"set use_from=yes set realname="****-ecg" set editor="vi"

Mutt - 调试(-D)

mutt -Dabort_nosubject=ask-yesabort_unmodified=yesalias_file="~/.muttrc"alias_format="%4n %2f %t %-10a   %r"allow_8bit is setallow_ansi is unsetarrow_cursor is unsetascii_chars is unsetaskbcc is unsetaskcc is unsetassumed_charset=""attach_charset=""attach_format="%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] "attach_sep="\n"attach_split is setattribution="On %d, %n wrote:"auto_tag is unsetautoedit is unsetbeep is setbeep_new is unsetbounce=ask-yesbounce_delivered is setbraille_friendly is unsetcharset="utf-8"check_mbox_size is unsetcheck_new is setcollapse_unread is setcompose_format="-- Mutt: Compose  [Approx. msg size: %l   Atts: %a]%>-"config_charset=""confirmappend is setconfirmcreate is setconnect_timeout=30content_type="text/plain"copy=yescrypt_autoencrypt is unsetcrypt_autopgp is setcrypt_autosign is unsetcrypt_autosmime is setcrypt_replyencrypt is setcrypt_replysign is unsetcrypt_replysignencrypted is unsetcrypt_timestamp is setcrypt_use_gpgme is unsetcrypt_use_pka is unsetcrypt_verify_sig=yesdate_format="!%a, %b %d, %Y at %I:%M:%S%p %Z"default_hook="~f %s !~P | (~P ~C %s)"delete=ask-yesdelete_untag is setdigest_collapse is setdisplay_filter=""dsn_notify=""dsn_return=""duplicate_threads is setedit_headers is unseteditor="vi"encode_from is unsetenvelope_from_address=""escape="~"fast_reply is unsetfcc_attach=yesfcc_clear is unsetfolder="~/Mail"folder_format="%2C %t %N %F %2l %-8.8u %-8.8g %8s %d %f"followup_to is setforce_name is unsetforward_decode is setforward_decrypt is setforward_edit=yesforward_format="[%a: %s]"forward_quote is unsetfrom=""gecos_mask="^[^,]*"hdrs is setheader is unsethelp is sethidden_host is unsethide_limited is unsethide_missing is sethide_thread_subject is sethide_top_limited is unsethide_top_missing is sethistory=10history_file="~/.mutthistory"honor_disposition is unsethonor_followup_to=yeshostname="ubuntu.localdomain"ignore_linear_white_space is unsetignore_list_reply_to is unsetimplicit_autoview is unsetinclude=ask-yesinclude_onlyfirst is unsetindent_string="> "index_format="%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %s"ispell="ispell"keep_flagged is unsetlocale="C"mail_check=5mail_check_recent is setmailcap_path="~/.mailcap:/usr/local/share/mutt/mailcap:/usr/local/etc/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap"mailcap_sanitize is setmaildir_trash is unsetmark_old is setmarkers is setmask="!^\\.[^.]"mbox="~/mbox"mbox_type=mboxmenu_context=0menu_move_off is setmenu_scroll is unsetmessage_format="%s"meta_key is unsetmetoo is unsetmh_purge is unsetmh_seq_flagged="flagged"mh_seq_replied="replied"mh_seq_unseen="unseen"mime_forward=nomime_forward_decode is unsetmime_forward_rest=yesmove=nonarrow_tree is unsetpager="builtin"pager_context=0pager_format="-%Z- %C/%m: %-20.20n   %s%*  -- (%P)"pager_index_lines=0pager_stop is unsetpgp_auto_decode is unsetpgp_autoinline is unsetpgp_check_exit is setpgp_clearsign_command=""pgp_decode_command=""pgp_decrypt_command=""pgp_encrypt_only_command=""pgp_encrypt_sign_command=""pgp_entry_format="%4n %t%f %4l/0x%k %-4a %2c %u"pgp_export_command=""pgp_getkeys_command=""pgp_good_sign=""pgp_ignore_subkeys is setpgp_import_command=""pgp_list_pubring_command=""pgp_list_secring_command=""pgp_long_ids is unsetpgp_mime_auto=ask-yespgp_replyinline is unsetpgp_retainable_sigs is unsetpgp_show_unusable is setpgp_sign_as=""pgp_sign_command=""pgp_sort_keys=addresspgp_strict_enc is setpgp_timeout=300pgp_use_gpg_agent is unsetpgp_verify_command=""pgp_verify_key_command=""pipe_decode is unsetpipe_sep="\n"pipe_split is unsetpost_indent_string=""postpone=ask-yespostponed="~/postponed"print=ask-noprint_command="lpr"print_decode is setprint_split is unsetprompt_after is setquery_command=""query_format="%4c %t %-25.25a %-25.25n %?e?(%e)?"quit=yesquote_regexp="^([ \t]*[|>:}#])+"read_inc=10read_only is unsetrealname="xianhua"recall=ask-yesrecord="~/sent"reflow_text is setreflow_wrap=78reply_regexp="^(re([\\[0-9\\]+])*|aw):[ \t]*"reply_self is unsetreply_to=ask-yesresolve is setreverse_alias is unsetreverse_name is unsetreverse_realname is setrfc2047_parameters is unsetsave_address is unsetsave_empty is setsave_history=0save_name is unsetscore is setscore_threshold_delete=-1score_threshold_flag=9999score_threshold_read=-1search_context=0send_charset="us-ascii:iso-8859-1:utf-8"sendmail="/usr/sbin/sendmail -oem -oi"sendmail_wait=0shell="/bin/bash"sig_dashes is setsig_on_top is unsetsignature="~/.signature"simple_search="~f %s | ~s %s"sleep_time=1smart_wrap is setsmileys="(>From )|(:[-^]?[][)(><}{|/DP])"smime_ask_cert_label is setsmime_ca_location=""smime_certificates=""smime_decrypt_command=""smime_decrypt_use_default_key is setsmime_default_key=""smime_encrypt_command=""smime_encrypt_with=""smime_get_cert_command=""smime_get_cert_email_command=""smime_get_signer_cert_command=""smime_import_cert_command=""smime_is_default is unsetsmime_keys=""smime_pk7out_command=""smime_sign_command=""smime_sign_opaque_command=""smime_timeout=300smime_verify_command=""smime_verify_opaque_command=""sort=datesort_alias=aliassort_aux=datesort_browser=alphasort_re is setspam_separator=","spoolfile="/var/mail/gdyshi"status_chars="-*%A"status_format="-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---"status_on_top is unsetstrict_threads is unsetsuspend is settext_flowed is unsetthorough_search is setthread_received is unsettilde is unsettime_inc=0timeout=600tmpdir="/tmp"to_chars=" +TCFL"uncollapse_jump is unsetuse_8bitmime is unsetuse_domain is setuse_envelope_from is unsetuse_from is setuser_agent is setvisual="vi"wait_key is setweed is setwrap=0wrap_headers=78wrap_search is setwrapmargin=0write_bcc is setwrite_inc=10

Mutt -帮助

mutt -helpMutt 1.5.23 (2014-03-12)usage: mutt [
] [-z] [-f 
 | -yZ]       mutt [
] [-x] [-Hi 
] [-s 
] [-bc 
] [-a 
 [...] --] 
 [...]       mutt [
] [-x] [-s 
] [-bc 
] [-a 
 [...] --] 
 [...] < message       mutt [
] -p       mutt [
] -A 
 [...]       mutt [
] -Q 
 [...]       mutt [
] -D       mutt -v[v]options:  -A 
    expand the given alias  -a 
 [...] --    attach file(s) to the message (附件)        the list of files must be terminated with the "--" sequence  -b 
    specify a blind carbon-copy (BCC) address  -c 
    specify a carbon-copy (CC) address  -D        print the value of all variables to stdout  -e     specify a command to be executed after initialization  -f 
    specify which mailbox to read  -F 
    specify an alternate muttrc file  (指定配置文件)  -H 
    specify a draft file to read header and body from  -i 
    specify a file which Mutt should include in the body  -m 
    specify a default mailbox type  -n        causes Mutt not to read the system Muttrc  -p        recall a postponed message  -Q 
    query a configuration variable  -R        open mailbox in read-only mode  -s 
    specify a subject (must be in quotes if it has spaces)  -v        show version and compile-time definitions  -x        simulate the mailx send mode  -y        select a mailbox specified in your `mailboxes' list  -z        exit immediately if there are no messages in the mailbox  -Z        open the first folder with new message, exit immediately if none  -h        this help message

参  数:

    -a<文件> 在邮件中加上附加文件。
    -b<地址> 指定密件副本的收信人地址。
    -c<地址> 指定副本的收信人地址。
    -f<邮件文件> 指定要载入的邮件文件。
    -F<配置文件> 指定mutt程序的设置文件,而不读取预设的.muttrc文件。
    -h 显示帮助。
    -H<邮件草稿> 将指定的邮件草稿送出。
    -i<文件> 将指定文件插入邮件内文中。
    -m<类型> 指定预设的邮件信箱类型。
    -n 不要去读取程序培植文件(/etc/Muttrc)。
    -p 在mutt中编辑完邮件后,而不想将邮件立即送出,可将该邮件暂缓寄出。
    -R 以只读的方式开启邮件文件。
    -s<主题> 指定邮件的主题。
    -v 显示mutt的版本信息以及当初编译此文件时所给予的参数。
    -x 模拟mailx的编辑方式。
    -z 与-f参数一并使用时,若邮件文件中没有邮件即不启动mutt。

Mutt - 应用

# 发送邮件 -s 主题 -a 附件 -c 收件人 < 文件(邮件内容)mutt -s "send mail" -a /home/****/.muttrc -c ****@qq.com < ./mail.txt # 这是的邮件内容 "TEST"echo "TEST" | mutt -s "send mail" -a /home/****/.muttrc  -c ****@qq.com

Mutt -交叉编译

export PATH=$PATH:/usr/local/ti-sdk-am335x-evm/linux-devkit/binexport CC=arm-arago-linux-gnueabi-gccexport CXX=arm-arago-linux-gnueabi-g++./configure --host=arm-arago-linux-gnueabi