LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
123
返回列表 发新帖
楼主: BnuFancy

mail命令可以发送附件吗?

[复制链接]
发表于 2005-4-7 21:29:05 | 显示全部楼层
可以用mail发送附件:

发送:

先用uuencode命令将邮件和附件编码

uuencode   <邮件名>   <附件文件名>  >>    <要发送的邮件名>

然后用mial命令将“要发送的邮件名”发送出去就可一了

接受:

用uudecode命令将收到的带附件的邮件文件解码
回复 支持 反对

使用道具 举报

发表于 2005-4-8 12:00:32 | 显示全部楼层
很老的脚本了, 希望还能用
  1. file_1=$1


  2. SUBJ="Send mail from Unix with file attachments"
  3. TO=root
  4. CC=root
  5. (
  6. cat << EOF
  7. To : ${TO}
  8. Subject : ${SUBJ}
  9. Cc : ${CC}
  10. EOF

  11. cat << EOF
  12. HOPE THIS WORKS
  13. This sample E-mail message demonstrates how one can attach
  14. files when sending messages with the Unix sendmail utility.
  15. EOF

  16. uuencode ${file_1} ${file_1##*/}
  17. # uuencode ${file_2} ${file_2##*/}
  18. # uuencode ${file_3} ${file_3##*/}

  19. ) | sendmail -v ${TO} ${CC}
复制代码
回复 支持 反对

使用道具 举报

发表于 2005-4-8 12:17:54 | 显示全部楼层
受到保存附件后需要uudecode 解开编码附件
回复 支持 反对

使用道具 举报

发表于 2005-5-26 23:12:53 | 显示全部楼层
发现可以用 mutt 的非交互方式发送附件:
$ echo "STRING" | mutt -s "SUBJECT" -i TEXTFILE -a ATTACHMENT1 -a ATTACHMENT2 USER@DOMAIN.com
回复 支持 反对

使用道具 举报

发表于 2005-5-27 08:16:16 | 显示全部楼层
1. How can I send e-mails with attached files?

  a. Use uuencode
  
     This is the simplest way to do this. For example

     $ uuencode surfing.jpeg surfing.jpeg | mail someone@some.where

     To send regular text as well

     $ (cat mailtext; uuencode surfing.jpeg surfing.jpeg) | mail someone@some.where

  b. Use MIME

     $ metasend -b -t someone@some.where -s "Hear our son!"  -m audio/basic -f crying.au

     These examples are adapted from
     http://www.shelldorado.com/articles/mailattachments.html which
     goes into much more detail about this.

  c. Use pine (with a patch) or mutt
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表