【工具】轻量级 linux 命令行发邮件工具--SendEmail

来源:互联网 发布:python 读取文件跳过 编辑:程序博客网 时间:2024/05/15 12:34

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


An Email Program for Sending SMTP Mail from a Command Line

About SendEmail
SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to learn and use.
SendEmail is licensed under the GNU GPL, either version 2 of the License or (at your option) any later version.
[Supported Platforms: Linux, BSD, OS X, Windows 98, Windows NT, Windows 2000, & Windows XP] 

Command Line Options
SendEmail has the following command line options:
sendEmail command line options

How do I install it?
Simply download, extract, and run "sendEmail" from a command prompt, it will give a usage summary. It is written in Perl, so no compilation needed. On a unix system if your perl binary is not installed at /usr/bin/perl you may need to edit the first line of the script. If you're running a Microsoft OS you may need to put a .pl extension on sendEmail so Windows will know to associate it with perl.

TLS Support
Starting with sendEmail v1.54, TLS support is included! To enable TLS support simply install the Net::SSLeay andIO::Socket::SSL perl modules. The following new command line parameters are now available:
    -o tls=auto This is the default, TLS will be used if possible.
    -o tls=yes Use this to require TLS for message delivery.
    -o tls=no Use this to disable TLS support.
If TLS is giving strange errors, try upgrading the Net::SSLeay and IO::Socket::SSL perl modules. Please do NOT report TLS bugs unless you have already done this! If you're running up-to-date versions of these modules and you are getting TLS errors, your detailed bug report will be appreciated. Yes, you can finally use SendEmail to send messages to your GMail account :)

Frequently Asked Questions
Q: How do I send email through GMail (Google Mail) servers?
A: Just use port 587 and TLS. Example:
sendEmail -o tls=yes -f YourEmail@gmail.com -t SomeoneYoureEmailing@domain.com -s smtp.gmail.com:587 -xu YourEmail@gmail.com -xp YOURPASSWORD -u "Hello from sendEmail" -m "How are you? I'm testing sendEmail from the command line." 

Q: I get the error "invalid SSL_version specified at /System/Library/Perl/Extras/5.16/IO/Socket/SSL.pm line 332.“ on my Apple. What do I do?
A: Here's what I got from one user. It's a workaround until I put a real fix in:
> Fixed it by using Perl v5.12 that's still on OSX Mavericks. > (just changed sendEmail line 1 from #!/usr/bin/perl -w to #!/usr/bin/perl5.12 -w)

Q: Can I use non-ascii characters, like é, in an email message body?
A: It's been reported that adding the command-line parameter -o message-charset=utf-8 solves this issue.

Q: I'm using the Windows version of sendEmail and I can't seem to send a message larger than 16kb.
A: This is a known issue. I believe it's an issue with the ActiveState Perl compiler, and I don't know of a work-around.

Q: I'm using the Windows version of sendEmail, and I get the error message "the ordinal 2586 could not be located in the dynamic link libraby LIBEAY32.dll", what do I do?
A: I don't know why this happens, but you can fix it by downloading the "No TLS Support" version of sendEmail. You won't be able to send email through an SMTP server that requires encryption, but it won't give you that error message.

Why not use sendmail?
Sendmail is a large and complex mail server. Installing this kind of mail software on servers (unless it's a mail server) is more of a security risk than it's worth. Not to mention it can be a real pain messing with configuration files and such. Systems need another simpler way to send email from the command prompt, and sendEmail provides this functionality. Its a simple, direct way to send email without the overhead of other conventional email software.

How can I send anonymous email?
SendEmail was not intended to be used for malicious purposes, like sending spam! However, there are often legitimate reasons to send email anonymously. I use the term "anonymous" to mean sending email from an address that isn't normally associated with just you. For example, sendEmail is a great script for emailing company newsletters where you want to send email from an "anonymous" account like newsletter@yourdomain.com.
To send "anonymous" email from a CLI with sendEmail, simply specify a from address that you want to use with the -f option, and unless your ISP's SMTP email server is picky, it will accept and deliver it.
View Example



1 0
原创粉丝点击