linux 原生系统发送电子邮件 (在本地与因特网)

有用的资料在 Linux mail 命令

 http://www.cnblogs.com/JemBai/archive/2012/01/24/2329136.html

还有这里 Linux系统下mail命令使用

http://www.php100.com/html/webkaifa/Linux/2009/0315/6309.html  (介绍的挺详细的)

 

可是上面的链接都没有说是怎么打开邮件代发服务的。所以在很大程度上,不是一个傻瓜教程。

针对我的系统 linuxmint 13 , ubuntu 12.04 的衍生版,我准备采用这种方法

一般准备开始使用的时候会遇到下面这样的问题

发现不在/usr/lib/sendmail 下面,那么用命令

find / -name sendmail -print

搜索了下,原来在 /usr/sbin/sendmail 中 (linuxmint 13)

于是直接调用

结果还出现请安装MTA

于是在软件源里面又搜索了下MTA

 

搜索了一下,大致了解了一下MTA的意思, mail transport agent

然后又google一下,觉得大家会有多种MTA解决方案。比较常见的有postfix

然后看了下postfix的具体内容

alex@universe / $ apt-cache show postfix
Package: postfix
Priority: optional
Section: mail
Installed-Size: 3373
Maintainer: LaMont Jones <lamont@debian.org>
Architecture: amd64
Version: 2.9.6-1~12.04.1
Replaces: mail-transport-agent
Provides: default-mta, mail-transport-agent
Depends: libc6 (>= 2.14), libdb5.1, libsasl2-2 (>= 2.1.24), libsqlite3-0 (>= 3.5.9), libssl1.0.0 (>= 1.0.0), debconf (>= 0.5) | debconf-2.0, netbase, adduser (>= 3.48), dpkg (>= 1.8.3), lsb-base (>= 3.0-6), ssl-cert, cpio
Recommends: python
Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre, sasl2-bin, libsasl2-modules, dovecot-common, resolvconf, postfix-cdb, mail-reader, ufw, postfix-doc
Conflicts: libnss-db (<< 2.2-3), mail-transport-agent, smail
Filename: pool/main/p/postfix/postfix_2.9.6-1~12.04.1_amd64.deb
Size: 1319662
MD5sum: b0f7d4d22db0931a3004aaaff0ba6804
SHA1: 9f5e22ece0f39eae298b535ff0a7d390a75401c1
SHA256: 0bbbe26a6298e282d948d61b71661014e9915cba3ccf3717e0a41e97f7441436
Description-en: High-performance mail transport agent
 Postfix is Wietse Venema's mail transport agent that started life as an
 alternative to the widely-used Sendmail program.  Postfix attempts to
 be fast, easy to administer, and secure, while at the same time being
 sendmail compatible enough to not upset existing users. Thus, the outside
 has a sendmail-ish flavor, but the inside is completely different.
Homepage: http://www.postfix.org
Description-md5: 98656fbf1bb45b53edd367037a2e5a90
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y
Task: mail-server

Package: postfix
Priority: optional
Section: mail
Installed-Size: 3353
Maintainer: LaMont Jones <lamont@debian.org>
Architecture: amd64
Version: 2.9.1-4
Replaces: mail-transport-agent
Provides: default-mta, mail-transport-agent
Depends: libc6 (>= 2.14), libdb5.1, libsasl2-2, libsqlite3-0 (>= 3.5.9), libssl1.0.0 (>= 1.0.0), debconf (>= 0.5) | debconf-2.0, netbase, adduser (>= 3.48), dpkg (>= 1.8.3), lsb-base (>= 3.0-6), ssl-cert, cpio
Recommends: python
Suggests: procmail, postfix-mysql, postfix-pgsql, postfix-ldap, postfix-pcre, sasl2-bin, libsasl2-modules, dovecot-common, resolvconf, postfix-cdb, mail-reader, ufw
Conflicts: libnss-db (<< 2.2-3), mail-transport-agent, smail
Filename: pool/main/p/postfix/postfix_2.9.1-4_amd64.deb
Size: 1309266
MD5sum: e86312470d009f8001983a62c718c81d
SHA1: af26fc8133a5f1fdb357a1b923c5bee7c5f0a3cc
SHA256: 5bd0b17affa241e5c620f95629136d3dfd319553f4c3cb74fa83e598c9e87e43
Description-en: High-performance mail transport agent
 Postfix is Wietse Venema's mail transport agent that started life as an
 alternative to the widely-used Sendmail program.  Postfix attempts to
 be fast, easy to administer, and secure, while at the same time being
 sendmail compatible enough to not upset existing users. Thus, the outside
 has a sendmail-ish flavor, but the inside is completely different.
Homepage: http://www.postfix.org
Description-md5: 98656fbf1bb45b53edd367037a2e5a90
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 5y


然后,准备安装postfix

sudo apt-get install postfix

会遇见下面的一个configuration of postfix

我们一般选择Internet site 就好了。

然后再选择

然后系统就开始自动安装了。

最后在系统安装信息的末尾,你能看到这个:

     After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
 * Stopping Postfix Mail Transport Agent postfix                         [ OK ]
 * Starting Postfix Mail Transport Agent postfix                         [ OK ]
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

 

上面说明MTA postfix服务已经在运行了

然后简单的,给本地用户发送一条mail,测试一下效果,采用方法如下:

看到

这时候再看看邮件内容是啥:

很好一目了然。是这样的邮件。

分析: 如果在发送邮件的时候,我们多加一些邮件选项,比如说Cc Bcc Forward Reply 等等,或者直接发送HTML代码格式的邮件,这样将更有说服力。

 

好了,上面的邮件发送只是本地邮件发送,我们现在需要来真格的,要看看在线发送到Internet的邮件服务!

这个先留下一会儿,我先去睡个觉。。

——————————————————分割线 07:03 A.M. 1st Augest————————————————————————

posted @ 2013-08-01 07:04  spaceship9  阅读(452)  评论(0编辑  收藏  举报