选择显示字体大小

windows95/98,nt下如何发email


unix环境下,cgi程序发email都是用sendmail, 在windows95/98,nt没有sendmail,cgi程序如何发邮件呢?其实方法多得很呢!

1.windows环境下发邮件程序

这类程序很多,如blat,sendmail for windows,cgimail等等,它们的用法和unix下的sendmail极其相似,许多unixcgi程序不用怎么修改就可以在windows下使用.

blat http://www.blat.com (免费)
sendmail for nt http://www.sendmail.com (商业软件)
cgimail http://www.stalkerlab.ch/ (免费)
sendmail for windows http://www.green-bean.com/bcware/sendmail.htm (共享软件)

另外zeng hui朋友(zeng_h@mail.hb.cnpc.com.cn)给我来信说他发现在sambar 4.1中的bin目录下有个mailit.exe文件,其功能与blat.exe相同,而且不用先安装.

2.采用perl.net::smtp

系统必须支持smtp协议,nt中可安装exchange server

use.net::smtp;

{
my $to = 'preston@home.com';
my $from = $env{user} $env{username};
my $subject = "another test";

my $smtp =.net::smtp->new('mail');

$smtp->mail($from);
$smtp->to($to);

$smtp->data();
$smtp->datasend("to: $to\n");
$smtp->datasend("from: $from\n");
$smtp->datasend("subject: $subject\n");
$smtp->datasend("x-mytoken: abcd\n");
$smtp->datasend("\n");
$smtp->datasend("a simple test message\n");
$smtp->dataend() print "failed send!\n";

$smtp->quit;
}

print "\nmail sent ok\n";
-----

注意"$env{user}"是unix中用的,而$env{username}"是windows nt中用的

3.用outlook发邮件

下面的程序在perl for win32 (build 316)正常运行过
# sender's name and password
#
my $sender = "microsoft outlook"; # profile to be used
my $passwd = "ms exhange settings password"; #profile password

# create a new mapi session
#
use ole;
$session = createobject ole 'mapi.session' die $!;

my $err = $session->logon($sender, $passwd);
if ($err) {
die "logon failed: $!";
}

# add a new message to the outbox.
#
$msg = $session->outbox->messages->add();

# add the recipient.
#
$rcpt = $msg->recipients->add();
$rcpt->{name} = 'recepient@host.org'; # email address of recepient
$rcpt->resolve();

# create a subject and a body.
#
$msg->{subject} = "test message";
$msg->{text} =
"this is a sample test message. using nt 4.0.

cheers,

mr. email";

# send the message and log off.
#
$msg->update();
$msg->send(0, 0, 0);
$session->logoff();

发送附件和拷贝也可以

$recipient='user@host.com';
$attachment='c:/attach.doc'
$profile="ms exchange settings";#profile name
$mailmeessage="hello";
$password="ms exhange settings password";#profile password
$subject='test';

system("mapisend -u \"$profile\" -p \"$password\" -f \"$attachment\" -s
\"$subject\" -r $recipient -m \"$mailmessage\"")

  


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons