代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Perl
】
使用SMTP发送邮件
作者:
oschina.net
/ 发布于
2011/3/15
/
1847
<div>msg2smtp.pl <div id="highlighter_591885" class="syntaxhighlighter perl"> <div class="bar show"> <div class="toolbar"><a style="width: 16px; height: 16px" class="item viewSource" title="view source" href="#viewSource" commandname="viewSource" highlighterid="highlighter_591885">view source</a> <div class="item copyToClipboard"><object id="highlighter_591885_clipboard" title="copy to clipboard" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="16" height="16" type="application/x-shockwave-flash"> <param name="_cx" value="423" /> <param name="_cy" value="423" /> <param name="FlashVars" value="" /> <param name="Movie" value="/js/syntax-highlighter-2.1.382/scripts/clipboard.swf" /> <param name="Src" value="/js/syntax-highlighter-2.1.382/scripts/clipboard.swf" /> <param name="WMode" value="Transparent" /> <param name="Play" value="0" /> <param name="Loop" value="-1" /> <param name="Quality" value="High" /> <param name="SAlign" value="" /> <param name="Menu" value="0" /> <param name="Base" value="" /> <param name="AllowScriptAccess" value="always" /> <param name="Scale" value="ShowAll" /> <param name="DeviceFont" value="0" /> <param name="EmbedMovie" value="0" /> <param name="BGColor" value="" /> <param name="SWRemote" value="" /> <param name="MovieData" value="" /> <param name="SeamlessTabbing" value="1" /> <param name="Profile" value="0" /> <param name="ProfileAddress" value="" /> <param name="ProfilePort" value="0" /> <param name="AllowNetworking" value="all" /> <param name="AllowFullScreen" value="false" /></object></div> <a style="width: 16px; height: 16px" class="item printSource" title="print" href="#printSource" commandname="printSource" highlighterid="highlighter_591885">print</a><a style="width: 16px; height: 16px" class="item about" title="?" href="#about" commandname="about" highlighterid="highlighter_591885">?</a></div> </div> <div class="lines"> <div class="line alt1"> <table> <tbody> <tr> <td class="number">001</td> <td class="content">"perl preprocessor">#!/usr/bin/perl </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">002</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">003</td> <td class="content">"perl comments"># $Id: msg2smtp.pl,v 1.8 2007/07/29 16:30:25 polak Exp $ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">004</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">005</td> <td class="content">"perl keyword">my "perl variable">$usage "perl plain">= qq! </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">006</td> <td class="content">"perl variable">$0 "perl plain">takes a mail message on STDIN and relays it to an SMTP server. </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">007</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">008</td> <td class="content">"perl variable">$0 "perl plain">-h HOST [options] </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">009</td> <td class="content">"spaces">"perl plain">-h HOST (hostname of SMTP server, often "perl string">'localhost'"perl plain">) </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">010</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">011</td> <td class="content">"spaces">"perl plain">Options: </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">012</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">013</td> <td class="content">"spaces">"perl plain">-p PORT (port of the SMTP server) </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">014</td> <td class="content">"spaces">"perl plain">-e HELO_DOMAIN (domain we "perl keyword">use "perl plain">when to say helo to smtp server) </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">015</td> <td class="content">"spaces">"perl plain">-U USERNAME (ESMTP auth username) </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">016</td> <td class="content">"spaces">"perl plain">-P PASSWORD (ESMTP auth password) </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">017</td> <td class="content">"spaces">"perl plain">-m MECHANISM (ESMTP auth mechanism - default is PLAIN) </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">018</td> <td class="content">"spaces">"perl plain">-d (shows SMTP conversation and perl debugging) </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">019</td> <td class="content">"spaces">"perl plain">!; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">020</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">021</td> <td class="content">"perl comments">#------------------------------------------ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">022</td> <td class="content">"perl comments"># INDEX </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">023</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">024</td> <td class="content">"perl comments"># 0. GPL License </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">025</td> <td class="content">"perl comments"># 1. Module Dependencies </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">026</td> <td class="content">"perl comments"># 2. Set options by Command-line Arguments </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">027</td> <td class="content">"perl comments"># 3. Read Message by STDIN </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">028</td> <td class="content">"perl comments"># 4. Extend Net::SMTP to allow us to choose an auth mechanism </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">029</td> <td class="content">"perl comments"># 5. Send message via SMTP </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">030</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">031</td> <td class="content">"perl comments">#------------------------------------------ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">032</td> <td class="content">"perl comments"># 0. GPL License </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">033</td> <td class="content">"perl comments"># </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">034</td> <td class="content">"perl comments"># This file is part of GNU Anubis. </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">035</td> <td class="content">"perl comments"># Copyright (C) 2001, 2002, 2003 The Anubis Team. </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">036</td> <td class="content">"perl comments"># </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">037</td> <td class="content">"perl comments"># GNU Anubis is free software; you can redistribute it and/or modify </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">038</td> <td class="content">"perl comments"># it under the terms of the GNU General Public License as published by </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">039</td> <td class="content">"perl comments"># the Free Software Foundation; either version 2 of the License, or </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">040</td> <td class="content">"perl comments"># (at your option) any later version. </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">041</td> <td class="content">"perl comments"># </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">042</td> <td class="content">"perl comments"># GNU Anubis is distributed in the hope that it will be useful, </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">043</td> <td class="content">"perl comments"># but WITHOUT ANY WARRANTY; without even the implied warranty of </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">044</td> <td class="content">"perl comments"># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">045</td> <td class="content">"perl comments"># GNU General Public License for more details. </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">046</td> <td class="content">"perl comments"># </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">047</td> <td class="content">"perl comments"># You should have received a copy of the GNU General Public License </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">048</td> <td class="content">"perl comments"># along with GNU Anubis; if not, write to the Free Software Foundation, </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">049</td> <td class="content">"perl comments"># Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">050</td> <td class="content">"perl comments"># </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">051</td> <td class="content">"perl comments"># msg2smtp.pl code: Michael de Beer <michael@debeer.org> </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">052</td> <td class="content">"perl comments"># ext_auth() mainly taken from the Net::SMTP module </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">053</td> <td class="content">"perl comments"># </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">054</td> <td class="content">"perl comments"># http://www.gnu.org/software/anubis/ </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">055</td> <td class="content">"perl comments"># </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">056</td> <td class="content">"perl comments">#------------------------------------------ </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">057</td> <td class="content">"perl comments"># 1. Module Dependencies </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">058</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">059</td> <td class="content">"perl keyword">use "perl plain">warnings; "perl keyword">use "perl plain">strict; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">060</td> <td class="content">"perl keyword">use "perl plain">Getopt::Std; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">061</td> <td class="content">"perl keyword">use "perl plain">vars qw!"perl variable">$opt_h "perl variable">$opt_p "perl variable">$opt_e "perl variable">$opt_U "perl variable">$opt_P "perl variable">$opt_d "perl variable">$opt_m"perl plain">!; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">062</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">063</td> <td class="content">"perl comments"># REQUIRED MODULES: </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">064</td> <td class="content">"perl keyword">use "perl plain">Mail::Address; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">065</td> <td class="content">"perl keyword">use "perl plain">Net::SMTP; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">066</td> <td class="content">"perl comments"># perl -MCPAN -e 'install Mail::Address' </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">067</td> <td class="content">"perl comments"># perl -MCPAN -e 'install Net::SMTP' </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">068</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">069</td> <td class="content">"perl comments"># OPTIONAL MODULES: Authen:SASL (for ESMTP auth) </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">070</td> <td class="content">"perl comments"># perl -MCPAN -e 'install Authen::SASL' </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">071</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">072</td> <td class="content">"perl comments"># Note: this script originally used functions from Mail::Box to: </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">073</td> <td class="content">"perl comments"># * parse messages and </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">074</td> <td class="content">"perl comments"># * interface with Net::SMTP </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">075</td> <td class="content">"perl comments"># However, I discovered Mail::Box did not support these options: </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">076</td> <td class="content">"perl comments"># 'port username password' </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">077</td> <td class="content">"perl comments"># So, I am not using Mail::Box. </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">078</td> <td class="content">"perl comments"># # use Mail::Box; use Mail::Transport::SMTP; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">079</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">080</td> <td class="content">"perl comments">#------------------------------------------ </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">081</td> <td class="content">"perl comments"># 2. Set options by Command-line Arguments </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">082</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">083</td> <td class="content">"perl plain">getopts("perl string">'dh:p:e:U:P:m:'"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">084</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">085</td> <td class="content">"perl keyword">my "perl plain">("perl variable">%smtp_options"perl plain">, "perl variable">$host"perl plain">, "perl variable">$username"perl plain">, "perl variable">$password"perl plain">, "perl variable">$auth_mech"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">086</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">087</td> <td class="content">"perl keyword">if "perl plain">("perl variable">$opt_h"perl plain">) { </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">088</td> <td class="content">"spaces">"perl variable">$host "perl plain">= "perl variable">$opt_h"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">089</td> <td class="content">"perl plain">} "perl keyword">else "perl plain">{ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">090</td> <td class="content">"spaces">"perl functions">print "perl variable">$usage"perl plain">, "perl string">"\n""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">091</td> <td class="content">"spaces">"perl keyword">exit"perl plain">(255); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">092</td> <td class="content">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">093</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">094</td> <td class="content">"perl variable">$smtp_options"perl plain">{Port} = "perl variable">$opt_p "perl keyword">if "perl plain">("perl variable">$opt_p"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">095</td> <td class="content">"perl variable">$smtp_options"perl plain">{Hello} = "perl variable">$opt_e "perl keyword">if "perl plain">("perl variable">$opt_e"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">096</td> <td class="content">"perl variable">$smtp_options"perl plain">{Debug} = 1 "perl keyword">if "perl plain">("perl variable">$opt_d"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">097</td> <td class="content">"perl variable">$username "perl plain">= "perl variable">$opt_U "perl keyword">if "perl plain">("perl variable">$opt_U"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">098</td> <td class="content">"perl variable">$password "perl plain">= "perl variable">$opt_P "perl keyword">if "perl plain">("perl variable">$opt_P"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">099</td> <td class="content">"perl variable">$auth_mech "perl plain">= "perl variable">$opt_m "perl plain">? "perl variable">$opt_m "perl plain">: "perl string">'PLAIN'"perl plain">; "perl comments"># not tested other AUTH mechanisms </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">100</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">101</td> <td class="content">"perl comments">#------------------------------------------ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">102</td> <td class="content">"perl comments"># 3. Read Message by STDIN </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">103</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">104</td> <td class="content">"perl comments"># read the message and parse the headers for RCPT and FROM </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">105</td> <td class="content">"perl keyword">my "perl plain">("perl variable">$from"perl plain">, "perl variable">@rcpt"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">106</td> <td class="content">"perl keyword">my "perl plain">("perl variable">$txt_head"perl plain">) = "perl string">''"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">107</td> <td class="content">"perl keyword">my "perl plain">("perl variable">$txt_body"perl plain">) = "perl string">''"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">108</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">109</td> <td class="content">"perl comments"># the only trick thing are To: lines that are folded </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">110</td> <td class="content">"perl comments"># I deal with that with 4 Rules, below. </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">111</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">112</td> <td class="content">"perl keyword">my "perl plain">("perl variable">$tmp"perl plain">, "perl variable">$readyflag"perl plain">, "perl variable">$chunk"perl plain">, "perl variable">@to_addresses"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">113</td> <td class="content">"perl variable">$readyflag "perl plain">= 0; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">114</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">115</td> <td class="content">"perl plain">HEAD: "perl keyword">while "perl plain">("perl variable">$tmp "perl plain">= <STDIN>) { </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">116</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">117</td> <td class="content">"perl comments"># Rule 1: If the line is a blank line, exit HEAD section </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">118</td> <td class="content">"spaces">"perl keyword">if "perl plain">("perl variable">$tmp "perl plain">=~ /^$/) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">119</td> <td class="content">"spaces">"perl keyword">if "perl plain">("perl variable">$readyflag "perl plain">eq 1) { </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">120</td> <td class="content">"spaces">"perl keyword">last"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">121</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">122</td> <td class="content">"spaces">"perl keyword">else "perl plain">{ </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">123</td> <td class="content">"spaces">"perl keyword">next "perl plain">HEAD; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">124</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">125</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">126</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">127</td> <td class="content">"perl comments"># Rule 2: If it is a folded line, add line to $chunk, skip to next line </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">128</td> <td class="content">"spaces">"perl keyword">if "perl plain">("perl variable">$tmp "perl plain">=~ /^\s+\S+/) { "perl variable">$chunk "perl plain">.= "perl variable">$tmp"perl plain">; "perl keyword">next "perl plain">HEAD }; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">129</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">130</td> <td class="content">"perl comments"># Rule 3: If it is not a folded line, process old chunk </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">131</td> <td class="content">"spaces">"perl variable">$_ "perl plain">= "perl variable">$chunk "perl plain">? "perl variable">$chunk "perl plain">: "perl string">''"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">132</td> <td class="content">"spaces">"perl keyword">if "perl plain">(/^From:/i) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">133</td> <td class="content">"spaces">"perl plain">s/^From://i; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">134</td> <td class="content">"spaces">"perl keyword">my "perl variable">@from_addresses"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">135</td> <td class="content">"spaces">"perl variable">@from_addresses "perl plain">= Mail::Address->parse("perl variable">$_"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">136</td> <td class="content">"spaces">"perl variable">$from "perl plain">= "perl functions">pop"perl plain">("perl variable">@from_addresses"perl plain">)->address; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">137</td> <td class="content">"spaces">"perl keyword">die "perl string">"From: address invalid" "perl keyword">unless "perl variable">$from"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">138</td> <td class="content">"spaces">"perl keyword">die "perl string">"there is more than one From: address" "perl keyword">if "perl variable">@from_addresses"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">139</td> <td class="content">"spaces">"perl variable">$readyflag "perl plain">= 1; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">140</td> <td class="content">"spaces">"perl plain">} "perl keyword">elsif "perl plain">(/^(To|CC|BCC):/i) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">141</td> <td class="content">"spaces">"perl plain">s/^(To|CC|BCC)://i; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">142</td> <td class="content">"spaces">"perl variable">@to_addresses "perl plain">= (); "perl comments"># re-initialize because we re-enter this loop </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">143</td> <td class="content">"spaces">"perl variable">@to_addresses "perl plain">= Mail::Address->parse("perl variable">$_"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">144</td> <td class="content">"spaces">"perl keyword">foreach "perl keyword">my "perl variable">$obj "perl plain">("perl variable">@to_addresses"perl plain">) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">145</td> <td class="content">"spaces">"perl functions">push "perl variable">@rcpt"perl plain">, "perl variable">$obj"perl plain">->address; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">146</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">147</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">148</td> <td class="content">"spaces">"perl variable">$txt_head "perl plain">.= "perl variable">$chunk "perl keyword">if "perl plain">("perl variable">$chunk"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">149</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">150</td> <td class="content">"perl comments"># Rule 4: start a new chunk </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">151</td> <td class="content">"spaces">"perl variable">$chunk "perl plain">= "perl variable">$tmp"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">152</td> <td class="content">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">153</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">154</td> <td class="content">"perl keyword">while "perl plain">(<STDIN>) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">155</td> <td class="content">"spaces">"perl variable">$txt_body "perl plain">.= "perl variable">$_"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">156</td> <td class="content">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">157</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">158</td> <td class="content">"perl comments">#if ($smtp_options{Debug}) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">159</td> <td class="content">"perl comments"># print "\n---BEGINNING OF DEBUG---\n"; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">160</td> <td class="content">"perl comments"># print "From: $from\n"; map {print "To: $_\n"} @rcpt; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">161</td> <td class="content">"perl comments"># print "MsgBody:\n$txt_body\n"; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">162</td> <td class="content">"perl comments"># print "---END OF DEBUG---\n"; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">163</td> <td class="content">"perl comments">#} </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">164</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">165</td> <td class="content">"perl comments">#------------------------------------------ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">166</td> <td class="content">"perl comments"># 4. Extend Net::SMTP to allow us to choose and auth mechanism </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">167</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">168</td> <td class="content">"perl comments"># We make an extend-auth method, as Net::SMTP::auth() </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">169</td> <td class="content">"perl comments"># does not seem to accurately pick a mechanism </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">170</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">171</td> <td class="content">"perl keyword">package "perl plain">Net::SMTP; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">172</td> <td class="content">"perl keyword">sub "perl plain">ext_auth { "perl comments"># taken from Net::SMTP, only modify $mechanisms </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">173</td> <td class="content">"spaces">"perl keyword">my "perl plain">("perl variable">$self"perl plain">, "perl variable">$username"perl plain">, "perl variable">$password"perl plain">, "perl variable">$mechanisms"perl plain">) = "perl variable">@_"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">174</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">175</td> <td class="content">"spaces">"perl keyword">require "perl plain">MIME::Base64; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">176</td> <td class="content">"spaces">"perl keyword">require "perl plain">Authen::SASL; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">177</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">178</td> <td class="content">"spaces">"perl keyword">my "perl variable">$m "perl plain">= "perl variable">$self"perl plain">->supports("perl string">'AUTH'"perl plain">,500,["perl string">"Command unknown: 'AUTH'""perl plain">]); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">179</td> <td class="content">"spaces">"perl keyword">return "perl keyword">unless "perl functions">defined "perl variable">$m"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">180</td> <td class="content">"spaces">"perl keyword">my "perl variable">$sasl"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">181</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">182</td> <td class="content">"spaces">"perl keyword">if "perl plain">("perl keyword">ref"perl plain">("perl variable">$username"perl plain">) and UNIVERSAL::isa("perl variable">$username"perl plain">,"perl string">'Authen::SASL'"perl plain">)) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">183</td> <td class="content">"spaces">"perl variable">$sasl "perl plain">= "perl variable">$username"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">184</td> <td class="content">"spaces">"perl variable">$sasl"perl plain">->mechanism("perl variable">$mechanisms"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">185</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">186</td> <td class="content">"spaces">"perl keyword">else "perl plain">{ </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">187</td> <td class="content">"spaces">"perl keyword">die "perl string">"auth(username, password)" "perl keyword">if "perl plain">not "perl functions">length "perl variable">$username"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">188</td> <td class="content">"spaces">"perl variable">$sasl "perl plain">= Authen::SASL->new(mechanism=> "perl variable">$mechanisms"perl plain">, </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">189</td> <td class="content">"spaces">"perl plain">callback => { user => "perl variable">$username"perl plain">, </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">190</td> <td class="content">"spaces">"perl plain">pass => "perl variable">$password"perl plain">, </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">191</td> <td class="content">"spaces">"perl plain">authname => "perl variable">$username"perl plain">, </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">192</td> <td class="content">"spaces">"perl plain">}); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">193</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">194</td> <td class="content">"spaces">"perl keyword">my "perl variable">$client "perl plain">= "perl variable">$sasl"perl plain">->client_new("perl string">'smtp'"perl plain">,${*"perl variable">$self"perl plain">}{"perl string">'net_smtp_host'"perl plain">},0); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">195</td> <td class="content">"spaces">"perl keyword">my "perl variable">$str "perl plain">= "perl variable">$client"perl plain">->client_start; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">196</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">197</td> <td class="content">"spaces">"perl comments"># We dont support sasl mechanisms that encrypt the socket traffic. </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">198</td> <td class="content">"spaces">"perl comments"># todo that we would really need to change the ISA hierarchy </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">199</td> <td class="content">"spaces">"perl comments"># so we dont inherit from IO::Socket, but instead hold it in an attribute </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">200</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">201</td> <td class="content">"spaces">"perl keyword">my "perl variable">@cmd "perl plain">= ("perl string">"AUTH""perl plain">, "perl variable">$client"perl plain">->mechanism, MIME::Base64::encode_base64("perl variable">$str"perl plain">,"perl string">''"perl plain">)); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">202</td> <td class="content">"spaces">"perl keyword">my "perl variable">$code"perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">203</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">204</td> <td class="content">"spaces">"perl keyword">while "perl plain">(("perl variable">$code "perl plain">= "perl variable">$self"perl plain">->command("perl variable">@cmd"perl plain">)->response()) == CMD_MORE) { </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">205</td> <td class="content">"spaces">"perl variable">@cmd "perl plain">= (MIME::Base64::encode_base64( </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">206</td> <td class="content">"spaces">"perl variable">$client"perl plain">->client_step( </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">207</td> <td class="content">"spaces">"perl plain">MIME::Base64::decode_base64( </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">208</td> <td class="content">"spaces">"perl plain">("perl variable">$self"perl plain">->message)[0] </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">209</td> <td class="content">"spaces">"perl plain">) </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">210</td> <td class="content">"spaces">"perl plain">), "perl string">''</td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">211</td> <td class="content">"spaces">"perl plain">)); </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">212</td> <td class="content">"spaces">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">213</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">214</td> <td class="content">"spaces">"perl variable">$code "perl plain">== CMD_OK; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">215</td> <td class="content">"perl plain">} </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">216</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">217</td> <td class="content">"perl comments">#------------------------------------------ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">218</td> <td class="content">"perl comments"># 5. Send message via SMTP </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">219</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">220</td> <td class="content">"perl keyword">package "perl plain">main; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">221</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">222</td> <td class="content">"perl keyword">my "perl variable">$smtp "perl plain">= Net::SMTP->new("perl variable">$host"perl plain">, "perl variable">%smtp_options"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">223</td> <td class="content">"perl variable">$smtp "perl plain">or "perl keyword">die "perl string">"failed to connect to SMTP server""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">224</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">225</td> <td class="content">"perl keyword">if "perl plain">("perl variable">$username"perl plain">) { </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">226</td> <td class="content">"spaces">"perl functions">print "perl string">"WARNING: failed ESMTP auth using username '$username'...trying to send anyway\n" "perl keyword">unless "perl variable">$smtp"perl plain">->ext_auth ("perl variable">$username"perl plain">, "perl variable">$password"perl plain">, "perl variable">$auth_mech"perl plain">); </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">227</td> <td class="content">"perl plain">}; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">228</td> <td class="content">"perl variable">$smtp"perl plain">->mail("perl variable">$from"perl plain">) or "perl keyword">die "perl string">"server rejected FROM address '$from'""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">229</td> <td class="content">"perl variable">$smtp"perl plain">->to("perl variable">@rcpt"perl plain">, {SkipBad => 1}) or "perl keyword">die "perl string">"server rejected all TO addresses""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">230</td> <td class="content">"perl variable">$smtp"perl plain">->data() or "perl keyword">die "perl string">"server crashed while preparing to send DATA""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">231</td> <td class="content">"perl variable">$smtp"perl plain">->datasend("perl variable">$txt_head"perl plain">) or "perl keyword">die "perl string">"server crashed while sending DATA.1""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">232</td> <td class="content">"perl variable">$smtp"perl plain">->datasend("perl string">"\n""perl plain">) or "perl keyword">die "perl string">"server crashed while sending DATA.2""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">233</td> <td class="content">"perl variable">$smtp"perl plain">->datasend("perl variable">$txt_body"perl plain">) or "perl keyword">die "perl string">"server crashed while sending DATA.3""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">234</td> <td class="content">"perl variable">$smtp"perl plain">->dataend() or "perl keyword">die "perl string">"server crashed while ending DATA""perl plain">; </td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">235</td> <td class="content">"perl variable">$smtp"perl plain">->quit or "perl keyword">die "perl string">"server crashed while quiting - message may not be lost""perl plain">;; </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">236</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">237</td> <td class="content">"perl plain">__END__ </td> </tr> </tbody> </table> </div> <div class="line alt2"> <table> <tbody> <tr> <td class="number">238</td> <td class="content">"spaces"></td> </tr> </tbody> </table> </div> <div class="line alt1"> <table> <tbody> <tr> <td class="number">239</td> <td class="content">"perl comments"># EOF</td> </tr> </tbody> </table> </div> </div> </div> </div>
试试其它关键字
发送邮件
同语言下
.
获取本机所有IP和设备的绑定情况
.
生成隨機密碼
.
取文件的最后修改时间
.
获取本机所有IP和设备的绑定情况
.
将perl脚本变成乱糟糟的一团
.
从 HTML网页中解析出链接
.
使用 HTTP::Request 请求 URL 并将响应保存到文件
.
使用指定的User-Agent抓取网页
.
使用 Net::SMTP发送邮件
.
编写的一个简单 Web服务器
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
oschina.net
贡献的其它代码
(
12
)
.
MySQL数据库每日自动备份的脚本
.
在VIM中使用GOOGLE进行搜索或者翻译
.
快速多线程ping
.
通过 ODBC 连接数据库并创建表
.
创建一个新的 ODBC 数据源
.
列举所有的 ODBC 驱动程序
.
获取 Windows 系统的版本
.
对存储过程表的列及值添加标记,方便修改
.
Socket 客户端获取服务器时间
.
Perl 解析 HTTP Header
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3