如何在ASP.net中使用java脚本添加CC

时间:2016-07-01 10:00:41

标签: javascript c# asp.net outlook-2010

function SendMail(to,body,sub)
{
    var theApp  ;  
    var theMailItem ;  
    var subject = sub;
    var msg = body;


    var theApp = new ActiveXObject("Outlook.Application")
    var theMailItem = theApp.CreateItem(0);
    theMailItem.to = to;
    theMailItem.Subject = (subject);
    theMailItem.Body = (msg);
    theMailItem.send();  

}

我使用上面的代码从客户端计算机发送mails,但在此我想添加cc任何人都可以帮助我,或者是否有任何其他方法从客户端发送mails帮助表示赞赏。提前致谢

2 个答案:

答案 0 :(得分:0)

邮件项目具有CC属性。只需在发送之前设置它。

theMailItem.CC = "carbon copy recipient goes here";

另外,请记住,属性名称区分大小写。因此,将to更改为To,将send更改为Send

答案 1 :(得分:0)

var theApp = new ActiveXObject("Outlook.Application");
        var objNS = theApp.GetNameSpace('MAPI');
        var theMailItem = theApp.CreateItem(0);
        theMailItem.cc = cc;
        theMailItem.to = to;
        theMailItem.Subject = (subject);
        theMailItem.Body = (msg);
        theMailItem.send();

我添加了这一行,var objNS = theApp.GetNameSpace(' MAPI');您现在应该能够找到cc属性。