zoukankan      html  css  js  c++  java
  • VS.NET通过OUTLOOK发邮件

    using System.Data;using Microsoft.Office.Interop.Outlook;

    //通過outlook發郵件
            public static void SendMailWithOutlook(string toEmail, string bodyEmail,string subjectEmail)
            {
                try
                {
                    Microsoft.Office.Interop.Outlook.Application olapp = new Microsoft.Office.Interop.Outlook.Application();
                    MailItem eMail = (MailItem)olapp.CreateItem(OlItemType.olMailItem);
                    eMail.Subject = subjectEmail;
                    eMail.To = toEmail;
                    eMail.Importance = OlImportance.olImportanceHigh;
                    eMail.BodyFormat = OlBodyFormat.olFormatHTML;
                    eMail.Body = bodyEmail;
                    eMail.HTMLBody = bodyEmail;
                    eMail.Importance = OlImportance.olImportanceLow;
                    ((_MailItem)eMail).Send();
                }
                catch
                {
                    MessageBox.Show("郵件未能成功能發送,可能是OUTLOOK故障,\r\n請與管理員聯繫!", "MES系統", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

  • 相关阅读:
    不用google 是不行的
    一些主题
    腾讯cdc空间
    断言assert的使用
    malloc()和free()的相关知识
    linux上面的sz,rz命令与ssh的配合
    寻找第k小的元素
    c语言中字符串处理函数
    详解之#ifdef和#ifndef
    搭建测试环境linux静态链接库与动态链接库的区别及动态库的创建
  • 原文地址:https://www.cnblogs.com/vic_lu/p/1810043.html
Copyright © 2011-2022 走看看