1.開啟筆記本

 

Domon 發表在 痞客邦 留言(0) 人氣()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.Mail;
using System.Net;

namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
//發gmail需要 using System.Net; & using System.Net.Mail;
Send_Gmail(textBox1.Text, "測試主題", "收件人地址");
}


public void Send_Gmail(string msg, string mysubject, string address)
{
MailMessage mmsg = new MailMessage("寄件人地址", address);
mmsg.IsBodyHtml = true; //設定是否採用HTML格式
mmsg.BodyEncoding = Encoding.UTF8; //設定mail內容的編碼
mmsg.SubjectEncoding = Encoding.UTF8; //設定mail主旨的編碼
mmsg.Priority = MailPriority.Normal; //設定優先權 1.High 2.Normail 3.Low
mmsg.Subject = mysubject; // mail主旨
mmsg.Body = msg; //mail內容

SmtpClient MySmtp = new SmtpClient("smtp.gmail.com", 587); //允許程式使用smtp來發mail,並設定smtp server & port
MySmtp.Credentials = new NetworkCredential("帳號", "密碼"); //設定帳號與密碼 需要using system.net;
MySmtp.EnableSsl = true; //開啟SSL連線 (gmail體系須使用SSL連線)
MySmtp.Send(mmsg);

MySmtp = null; //將MySmtp清空
mmsg.Dispose(); //釋放資源

 

 

 




}
}
}

Domon 發表在 痞客邦 留言(0) 人氣()

Dear All,

 

Domon 發表在 痞客邦 留言(0) 人氣()

如何製作 reg 檔 註冊檔 
使用 Regedit 來編輯 registry 是很方便的一件事, 我們常常看到 .reg 的檔案可以匯入新的機碼或值, 或是編輯已存在的值或是設成空白, 但似乎對移除該值或是該機碼則無法使用 .reg 的檔案來進行, 本篇文章旨在利用 .reg 檔即可做到 新增 / 移除 / 編輯 某值或機碼. 

Domon 發表在 痞客邦 留言(0) 人氣()