国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

c#如何發郵件?

2024-07-21 02:19:16
字體:
來源:轉載
供稿:網友
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • easy, too easy;

    --------------------code---------------------

    private void sengmill_net()
    {//.net smtp類進行郵件發送,支持認證,附件添加;
    system.web.mail.mailmessage mailmsg = new system.web.mail.mailmessage();
    mailmsg.from = this.tb_from.text.trim();
    mailmsg.to = this.tb_to.text.trim();
    mailmsg.body = this.tb_mailbody.text.trim();
    mailmsg.subject = "test mail from hz";
    /* 附件的粘貼, ^_^,笨了點;
    if(this.att1.value.tostring().trim()!=string.empty)
    mailmsg.attachments.add(new system.web.mail.mailattachment(this.att1.value.tostring().trim()));
    if(this.att2.value.tostring().trim()!=string.empty)
    mailmsg.attachments.add(new system.web.mail.mailattachment(this.att2.value.tostring().trim()));
    if(this.att3.value.tostring().trim()!=string.empty)
    mailmsg.attachments.add(new system.web.mail.mailattachment(this.att3.value.tostring().trim()));
    */
    mailmsg.fields.add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
    //是否需要驗證,一般是要的
    mailmsg.fields.add
    ("http://schemas.microsoft.com/cdo/configuration/sendusername", "gallon_han");
    //自己郵箱的用戶名
    mailmsg.fields.add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "218500");
    //自己郵箱的密碼
    system.web.mail.smtpmail.smtpserver = this.tb_smtpserver.text.trim();
    system.web.mail.smtpmail.send(mailmsg);
    }


    上一篇:C#學習之旅

    下一篇:C#與Excel的交互示例

    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 基隆市| 南京市| 铜鼓县| 北流市| 临江市| 富源县| 江陵县| 新竹市| 彰化市| 三河市| 土默特右旗| 芮城县| 英超| 通榆县| 岳西县| 青铜峡市| 灵武市| 广元市| 灵山县| 河间市| 莒南县| 五常市| 开平市| 怀来县| 溧阳市| 平顺县| 沭阳县| 皮山县| 尉氏县| 新疆| 双牌县| 栾川县| 红原县| 乐都县| 金川县| 玉环县| 重庆市| 永善县| 奈曼旗| 东丰县| 马鞍山市|