千家信息网

sendEmail-参数的示例分析

发表于:2025-02-01 作者:千家信息网编辑
千家信息网最后更新 2025年02月01日,本篇文章给大家分享的是有关sendEmail-参数的示例分析,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。还在为Linux下没有便捷的邮
千家信息网最后更新 2025年02月01日sendEmail-参数的示例分析

本篇文章给大家分享的是有关sendEmail-参数的示例分析,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

还在为Linux下没有便捷的邮件程序苦恼,还在为复杂的邮件服务器架设Google N多网页? 对于小型,便捷的Linux下命令行邮件程序,sendEmail使得这一切变得轻松可行。一起来看看吧。

点击(此处)折叠或打开

  1. [python] view plain copy print?

  2. 一、sendEmail介绍

  3. SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this

  4. free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl

  5. programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is

  6. unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to

  7. learn and use.

  8. SendEmail is licensed under the GNU GPL, either version 2 of the License or (at your option) any later version.

  9. [Supported Platforms: Linux, BSD, OS X, Windows 98, Windows NT, Windows 2000, & Windows XP]


  10. 总的来说sendEmail简单,轻量级,命令行,可伸缩,跨平台。


  11. 二、下载与安装

  12. 下面的地址是sendEmail的下载及详细说明

  13. http://caspian.dotconf.net/menu/Software/SendEmail/


  14. 下面是安装描述,总共四个步骤就搞定。

  15. ------------------

  16. Installation

  17. ------------------


  18. SendEmail is a perl script/program, and only needs to be copied to a directory

  19. in your path to make it accessible. Most likely the following steps will

  20. be sufficient:


  21. 1) Extract the package

  22. tar -zxvf sendEmail-v1.XX.tar.gz


  23. 2) Copy the sendEmail script to /usr/local/bin

  24. cp -a sendEmail-v1.XX/sendEmail /usr/local/bin


  25. 3) Make sure its executable

  26. chmod +x /usr/local/bin/sendEmail


  27. 4) Run it

  28. sendEmail

  29. or

  30. /usr/local/bin/sendEmail


  31. 三、用法

  32. 直接输入sendEmail,将出现该工具的用法介绍,如下所示。由于用法也简单明了,因此不一一解释

  33. robin@SZDB:~/dba_scripts/sendEmail-v1.56> ./sendEmail


  34. sendEmail-1.56 by Brandon Zehm


  35. Synopsis: sendEmail -f ADDRESS [options]


  36. Required:

  37. -f ADDRESS from (sender) email address

  38. * At least one recipient required via -t, -cc, or -bcc

  39. * Message body required via -m, STDIN, or -o message-file=FILE


  40. Common:

  41. -t ADDRESS [ADDR ...] to email address(es)

  42. -u SUBJECT message subject

  43. -m MESSAGE message body

  44. -s SERVER[:PORT] smtp mail relay, default is localhost:25


  45. Optional:

  46. -a FILE [FILE ...] file attachment(s)

  47. -cc ADDRESS [ADDR ...] cc email address(es)

  48. -bcc ADDRESS [ADDR ...] bcc email address(es)

  49. -xu USERNAME username for SMTP authentication

  50. -xp PASSWORD password for SMTP authentication


  51. Paranormal:

  52. -b BINDADDR[:PORT] local host bind address

  53. -l LOGFILE log to the specified file

  54. -v verbosity, use multiple times for greater effect

  55. -q be quiet (i.e. no STDOUT output)

  56. -o NAME=VALUE advanced options, for details try: --help misc

  57. -o message-content-type=

  58. -o message-file=FILE -o message-format=raw

  59. -o message-header=HEADER -o message-charset=CHARSET

  60. -o reply-to=ADDRESS -o timeout=SECONDS

  61. -o username=USERNAME -o password=PASSWORD

  62. -o tls= -o fqdn=FQDN



  63. Help:

  64. --help the helpful overview you're reading now

  65. --help addressing explain addressing and related options

  66. --help message explain message body input and related options

  67. --help networking explain -s, -b, etc

  68. --help output explain logging and other output options

  69. --help misc explain -o options, TLS, SMTP auth, and more


  70. 查看详细的帮助文件,如下方式:

  71. ./sendEmail --help addressing

  72. ./sendEmail --help message


  73. 四、示例

  74. #发送者使用任意的邮箱方式发送邮件

  75. robin@SZDB:~> sendEmail -f robinson@oracle.com \

  76. > -t robinson.cheng@trade.com \

  77. > -u "Test Mail" \

  78. > -m "This is a test mail from Robinson"

  79. Dec 18 14:10:23 szdb sendEmail[18494]: Email was sent successfully!


  80. #发送者使用一个真实存在的互联网邮件服务器来发送邮件

  81. robin@SZDB:~> sendEmail -f rocket010824@163.com \

  82. > -t robinson.cheng@trade.com \

  83. > -u "Test Mail" \

  84. > -s smtp.163.com \

  85. > -xu jackson \

  86. > -xp temp_000 \

  87. > -m "This is test mail from Robinson"

  88. Dec 18 14:13:24 szdb sendEmail[18500]: Email was sent successfully!


  89. 发送给多个邮件接收人

  90. robin@SZDB:~> sendEmail -f robinson@oracle.com \

  91. > -t "Robinson cheng " jackson@163.com \

  92. > -u "Send email to mutiple people" \

  93. > -m "This is a test mail"

  94. Dec 18 14:24:57 szdb sendEmail[18537]: Email was sent successfully!


  95. 使用抄送,密送接收人

  96. robin@SZDB:~> sendEmail -f robinson@oracle.com \

  97. > -t "Robinson cheng " \

  98. > -cc jason.wu@trade.com \

  99. > -bcc jackson@163.com \

  100. > -u "Test mail " \

  101. > -m "This is a test mail"


  102. 发送带有附件的邮件

  103. robin@SZDB:~> sendEmail -f robinson@oracle.com \

  104. > -t "Robinson cheng " \

  105. > -cc jason.wu@trade.com \

  106. > -u "Test mail with multi attached" \

  107. > -m "This is a test mail with multi attached" \

  108. > -a /users/robin/addmrpt_1_11584_11649.txt "/users/robin/Temp log"

  109. Dec 18 14:43:35 szdb sendEmail[18664]: Email was sent successfully!


  110. #使用文件内容作为邮件的body

  111. robin@SZDB:~> sendEmail -f robinson@oracle.com \

  112. > -t "Robinson cheng " \

  113. > -u "Test mail and the body from file contents" \

  114. > -o message-file=/users/robin/addmrpt_1_11584_11649.txt

  115. Dec 18 14:50:39 szdb sendEmail[18715]: Email was sent successfully!


  116. robin@SZDB:~> cat addmrpt_1_11584_11649.txt | sendEmail -f robinson@oracle.com \

  117. > -t "Robinson cheng " \

  118. > -u "Test mail and the body from file contents"

  119. Reading message body from STDIN because the '-m

以上就是sendEmail-参数的示例分析,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注行业资讯频道。

0