大尾巴狼

所谓大尾巴狼,就是装腔作势。

打开Outlook发邮件界面,发邮件

        private void SendMailAttach(string to,string bcc,string subject,string body,bool html,string FileNameforEMail)
        
{
            Outlook._Application oApp 
= new Outlook.Application();      

            Outlook.NameSpace oNameSpace
= oApp.GetNamespace("MAPI");              

            
try
            
{
                oNameSpace.Logon(Missing.Value, Missing.Value,
true,true);  

                Outlook.MAPIFolder oOutboxFolder 
= oNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);

                Outlook.ApplicationClass a 
= new Outlook.ApplicationClass();

                Outlook.MailItemClass tt;

                tt
=(Outlook.MailItemClass)a.CreateItem(OlItemType.olMailItem);               

                tt.To
=to;
                tt.CC 
= bcc;

                tt.Subject
=subject;

                
if(html)
                
{
                    tt.HTMLBody
=body;
                }

                
else
                
{
                    tt.Body
=body;    
                }


                tt.SaveSentMessageFolder
=oOutboxFolder;

                tt.Attachments.Add(FileNameforEMail,Missing.Value,Missing.Value,Missing.Value);

                tt.Display(
null);                
            }

            
finally
            
{
                oNameSpace.Logoff();

            }


        }

posted on 2006-09-18 16:00  大尾巴狼  阅读(855)  评论(0编辑  收藏  举报

导航