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);
                }
            }

  • 相关阅读:
    面向对象
    原型链
    HTTP协议
    java连接数据库(jdbc)调用配置文件
    MySQL-学习笔记
    JAVA-集合框架
    JAVA-多线程
    java中的try-catch-finally异常处理(学习笔记)
    ADO.NET增、删、改、查
    C#资源管理器
  • 原文地址:https://www.cnblogs.com/vic_lu/p/1810043.html
Copyright © 2011-2022 走看看