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

  • 相关阅读:
    异步-promise、async、await
    node
    node基础 day1
    gulp的简介以及使用方法
    web前端安全——常见的web攻击方法
    Linux修改IP地址
    在linux下批量删除文件
    常用内容的正则表达式
    Oracle 数据库自带用户有哪些
    统计Oracle数据库当前User下各表的记录数
  • 原文地址:https://www.cnblogs.com/vic_lu/p/1810043.html
Copyright © 2011-2022 走看看