[removed] Open Outlook and add attachments to new email

后端 未结 2 1738
误落风尘
误落风尘 2020-12-21 12:29

I am trying to add attachment to new email in Outlook.

Like below (taken from here):

function sendEmail(){
  try{
    var theApp = new ActiveXObjec         


        
2条回答
  •  没有蜡笔的小新
    2020-12-21 12:56

           try{
              var theApp = new ActiveXObject("Outlook.Application");
              var objNS = theApp.GetNameSpace('MAPI');
              var theMailItem = theApp.CreateItem(0); // value 0 = MailItem
              theMailItem.to = ('test@gmail.com');
              theMailItem.Subject = ('test');
              theMailItem.Body = ('test');
              theMailItem.Attachments.Add("C:\\file.txt");
              theMailItem.display();
          }
          catch (err) {
             alert(err.message);
          } 
       }
    
    semi colon is missing in the path 
    
    
    

提交回复
热议问题