Microsoft Jscript电子邮件模块? [英] Microsoft Jscript Email Module?

查看:159
本文介绍了Microsoft Jscript电子邮件模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一个类似于python的MS Jscript(不是Jscript .net)的电子邮件模块?

I was wondering if there is an Email module for MS Jscript (not Jscript .net) similar to the one in python?

推荐答案

您可以使用协作数据对象(CDO) COM API。

You can use the Collaboration Data Objects (CDO) COM API.

以下是使用CDO发送文本电子邮件的方式:

Here's how you can send a text e-mail using CDO:

SendEMail("from@example.com", "to@example.com", "Subject", "Text body"); 

function SendEMail(from, to, subject, body)
{
  try
  {
    var oMsg      = new ActiveXObject("CDO.Message");
    oMsg.From     = from;
    oMsg.To       = to;
    oMsg.Subject  = subject;
    oMsg.TextBody = body;
    oMsg.Send(); 
  }
  catch(e)
  {
    WScript.Echo("Error: " + e.description);
  }
}

此页面提供了一些更多的CDO使用示例(他们在VBScript中,但应该帮助您获得想法)。另请参阅MSDN上的 CDO参考

This page provides some more CDO usage examples (they're in VBScript, but should help you get the idea). See also the CDO Reference at MSDN.

这篇关于Microsoft Jscript电子邮件模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆