Chinaunix

标题: 请教shell实现html邮件的发送 [打印本页]

作者: peacock66    时间: 2006-09-05 16:06
标题: 请教shell实现html邮件的发送
经常用shell来发送系统检查的邮件
只会cat file |mail -----------
这样的方式,在收到邮件后,通常都是一个很普通的形式.
有看到收件格式是html格式的,显得非常漂亮,而且一目了然,但不晓得怎么实现,各位高人是否知晓,敬请告知!!!
作者: r2007    时间: 2006-09-05 16:13

HTMLizer or txt2html
作者: 小渔儿    时间: 2006-09-05 16:32
有linux或unix下的转换工具吗
问另一个问题,mail命令怎么发带附件的邮件

[ 本帖最后由 小渔儿 于 2006-9-5 16:37 编辑 ]
作者: peacock66    时间: 2006-09-05 16:37
标题: 回复 3楼 小渔儿 的帖子
mail命令好象没有带附件的,有另外的工具来实现的.
作者: lovetide    时间: 2006-09-05 17:25

  1. echo "<h1>你好</h1><p style=\"color:red; background-color:gray; height:10em;\">html 邮件测试</p>" | email --html --smtp-user 发送邮件所用的帐号 --smtp-pass 发送邮件所用的密码 --subject "这里是标题" --attach 文件1.zip,文件2.jpg,文件3.tar --cc 抄送到邮件地址 -bcc 暗送到邮件地址 收件人邮件地址
复制代码

[ 本帖最后由 lovetide 于 2006-9-5 17:31 编辑 ]
作者: 4Aiur    时间: 2006-09-05 17:37
看看这个
http://bbs.chinaunix.net/viewthr ... 3%26filter%3Ddigest
作者: 寂寞烈火    时间: 2006-09-05 17:42
原帖由 小渔儿 于 2006-9-5 16:32 发表
有linux或unix下的转换工具吗
问另一个问题,mail命令怎么发带附件的邮件

http://bbs.chinaunix.net/viewthr ... p;page=1#pid3647964
作者: li2002    时间: 2006-09-05 20:57
原帖由 lovetide 于 2006-9-5 17:25 发表
[code]
echo "<h1>你好</h1><p style=\"color:red; background-color:gray; height:10em;\">html 邮件测试</p>" | email --html --smtp-user 发送邮件所用的帐号 - ...


email 这个命令好像没有在我的linux里,是另外装的吗
作者: lovetide    时间: 2006-09-06 09:07
呵呵,我是在 Windows 下的 cygwin 仿 unix 环境下用 email 的,cygwin 自身带这个工具,我没用过真实的 linux,不知道有没有

email 工具的主页
http://email.cleancode.org/


  1. $ email --version
  2. email - By: Dean Jones. Email: dj@cleancode.org.
  3. Version 2.5.0 - Date 06/16/2006-10:13:00AM_EDT
复制代码

[ 本帖最后由 lovetide 于 2006-9-6 09:16 编辑 ]
作者: yindows    时间: 2006-09-06 14:25
用mutt

#mutt -h
Mutt 1.4.2.1i (2004-02-12)
usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]
       mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] <addr> [ ... ]
       mutt [ -n ] [ -e <cmd> ] [ -F <file> ] -p
       mutt -v[v]

options:
  -a <file>     attach a file to the message
  -b <address>  specify a blind carbon-copy (BCC) address
  -c <address>  specify a carbon-copy (CC) address
  -e <command>  specify a command to be executed after initialization
  -f <file>     specify which mailbox to read
  -F <file>     specify an alternate muttrc file
  -H <file>     specify a draft file to read header from
  -i <file>     specify a file which Mutt should include in the reply
  -m <type>     specify a default mailbox type
  -n            causes Mutt not to read the system Muttrc
  -p            recall a postponed message
  -R            open mailbox in read-only mode
  -s <subj>     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
作者: 寂寞烈火    时间: 2006-09-06 14:41
原帖由 yindows 于 2006-9-6 14:25 发表
用mutt

#mutt -h
Mutt 1.4.2.1i (2004-02-12)
usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]
       mutt [ -nx ] [ -e <cmd> ] [ -a &l ...

不错~
作者: wzw880    时间: 2013-08-06 14:19
虽然这帖子很老了,回复下,希望能帮到需要的朋友!
在别的帖子看见解决方法:linux使用mail函数发送需要添加 header参数,将发送内容指定为txt/html
例如:
如果想让邮件样式更美观点,可以先用foxmail先写好HTML邮件,在把对应的html代码拷到命令前面(即<b><div style='color:red'>正文内容</div></b>这部分)。





欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2