当前位置:软件学习 > 其它软件 >>

windows平台下通过blat发送邮件用法小结

在linux平台的命令行下可以使用mail命令来发送邮件,windows平台没有内置的命令,但可以使用开源的 blat,其官方主页为 http://www.blat.net/

 


blat的使用非常简单,仅需两步

1.使用 "blat -install <server addr> <sender's addr>"进行发送邮件服务器的配置

2.使用 "blat -to <recipient> -subject <subject name> -body <body content> -attach a.txt,b.xls"发送邮件

 


示例:

有些smtp可能要求进行用户验证,如qq邮箱,则使用如下命令配置blat


blat -install smtp.qq.com 123456@qq.com -u 123456 -pw mypassword

 


直接使用某个文件的内容作为邮件正文

blat aa.txt -to 654321@qq.com -subject "My first blat email"

 


使用blat配合gmail使用的说明见 Using Blat, Stunnel and Gmail Together

 


更详细的关于blat的说明


[plain] Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29) 
 
 
Win32 console utility to send mail via SMTP or post to usenet via NNTP 
by P.Mendes,M.Neal,G.Vollant,T.Charron,T.Musson,H.Pesonen,A.Donchey,C.Hyde 
  http://www.blat.net 
syntax: 
  Blat <filename> -to <recipient> [optional switches (see below)] 
  Blat -install <server addr> <sender's addr> [<try>[<port>[<profile>]]] [-q] 
  Blat -profile [-delete | "<default>"] [profile1] [profileN] [-q] 
  Blat -h 
 
-------------------------------- Installation --------------------------------- 
-install[SMTP|NNTP|POP3] <server addr> <sender's email addr> [<try n times> 
                [<port> [<profile> [<username> [<password>]]]]] 
                : set server, sender, number of tries and port for profile 
                  (<try n times> and <port> may be replaced by '-') 
                  port defaults are SMTP=25, NNTP=119, POP3=110 
                  default profile can be specified with a '-' 
                  username and/or password may be stored to the registry 
                  order of options is specific 
                  use -installNNTP for storing NNTP information 
                  use -installPOP3 for storing POP3 information 
                      (sender and try are ignored, use '-' in place of these) 
 
--------------------------------- The Basics ---------------------------------- 
<filename>      : file with the message body to be sent 
                  if your message body is on the command line, use a hyphen (-) 
                  as your first argument, and -body followed by your message 
                  if your message will come from the console/keyboard, use the 
                  hyphen as your first argument, but do not use -body option. 
-of <file>      : text file containing more options (also -optionfile) 
-to <recipient> : recipient list (also -t) (comma separated) 
-tf <file>      : recipient list filename 
-cc <recipient> : carbon copy recipient list (also -c) (comma separated) 
-cf <file>      : cc recipient list filename 
-bcc <recipient>: blind carbon copy recipient list (also -b) 
                  (comma separated) 
-bf <file>      : bcc recipient list filename 
-maxNames <x>   : send to groups of <x> number of recipients 
-ur             : set To: header to Undisclosed Recipients if not using the 
                  -to and -cc options 
-subject <subj> : subject line, surround with quotes to include spaces(also -s) 
-ss             : suppress subject line if not defined 
-sf <file>      : file containing subject line 
-body <text>    : message body, surround with quotes to include spaces 
-sig <file>     : text file containing your email signature 
-tag <file>     : text file containing taglines, to be randomly chosen 
-ps <file>      : final message text, possibly for unsubscribe instructions 
 
----------------------------- Registry overrides ------------------------------ 
-p <profile>    : send with server, user, and port defined in <profile> 
                : use username and password if defined in <profile> 
-profile        : list all profiles in the Registry 
-server <addr>  : specify SMTP server to be used (optionally, addr:port) 
-serverSMTP <addr> 
                : same as -server 
-serverNNTP <addr> 
                : specify NNTP server to be used (optionally, addr:port) 
-serverPOP3 <addr> 
                : specify POP3 server to be used (optionally, addr:port) 
                  when POP3 access is required before sending email 
-f <sender>     : override the default sender address (must be known to server) 
-i <addr>       : a 'From:' address, not necessarily known to the server 
-port <port>    : port to be used on the SMTP server, defaults to SMTP (25) 
-portSMTP <port>: same as -port 补充:软件开发 , 其他 ,

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,