Application Development

Software technique, Skills & Applications

Outlook December 3, 2007

meetme @ 7:12 pm

2007-2-3 16:20:22gmail帐号的OUTLOOK设置

 gmail帐号——OUTLOOK的设置:

以下是关键步骤:

服务器信息
接收邮件服务器 (POP3): pop.gmail.com
邮件发送服务器 (SMTP): smtp.gmail.com

登录信息
用户名:输入您的 Gmail 用户名(包括”@gmail.com“)
密码:输入您的 Gmail 密码

单击”其他设置…“,然后单击”发送服务器“标签。

选中”我的发送服务器 (SMTP) 要求验证”旁边的复选框,然后选择”使用与接收邮件服务器相同的设置”。

单击”高级”标签,然后选中”接收服务器 (POP3)”下 面”此服务器要求安全连接 (SSL)”旁边的复选框。

选中”发送服务器 (SMTP)”下面”此服务器要求安全连接 (SSL)”旁边的复选框,然后在”发送服务器 (SMTP):”旁边的框中入”465″。

pop.mail.yahoo.com
smtp.mail.yahoo.com
SMTP口: 587
POP3口: 110

 你还在用邮件客户端下载邮件

谁在说用OutLook下了邮件后,回到家里就不能下邮件来看了?
只能说你不会用OutLook!所以骂你一声饭桶你也得听着!!
哈哈~!~!
告诉你个方法,你挨了骂也会觉得值得!!
因为OutLook默认是把所有邮件都放在那个叫做“个人文件夹”里的,如果你在你家里电脑上的OutLook把邮件帐户那里设置另一个文件夹,不要设在默认的“个人文件夹”里,你就又可以下邮件到家里的电脑上来了!!
具体操作:(以OutLook2003为例)
1.前提:一定要把每一个邮件帐户那里“在邮件服务器上保留副本”前打个勾!!!(如果不知道在哪里设置,那就别看下去了!)
2.点“工具”——“电子邮件帐户”——选中“查看或更改现在电子邮件帐户”——“下一步”——在“个人文件夹”后面点“新建OutLook数据文件”——选中“Office OutLook个人文件夹文件(.pst)”——“确定”——选个你自己清楚的地方,取个你自己的名字吧!!但是保留类型不要改!!——“确定”——接下来的“名称”,你也可以取个和你刚才取的名字一样。选择是否加密以及密码等等——“确定”——选择“将新电子邮件投递到下列位置”到你刚设定的文件夹,点“完成”,好了。重启OutLook 2003,你看看有什么反应?你以前下过的邮件又全部给你下来了!!!就是同一台机子上都可以!!
3.我还是觉得用客户端好,我公司有200多个下属机构,我最近在收一个统计数据,全是用邮件附件形式给我发来,每个单位有5个不同的数据包,要一周做完,你说说用WEB形式行吗?你累死也做不完!!
用客户端呢?呵呵,你只要打开它就行了!!我用两个yahoo的2G邮箱(元旦时免费升到2G的,呵呵。)很快就…………呵呵。

想在本地通过邮件客户端收到gmail邮箱的信件,系统应该如何配置?本文告诉你——

  1.在线开通

  首先要开通gmail的本地收信功能。操作方法如下:

  登陆gmail邮箱,打开settings—forwarding and pop,点disable forwarding 和enable pop for all mail,save changes

  2.客户端设置

  接收邮件服务器填写:pop.gma

利用Gmail收取非Gmail邮箱的邮件_邮件工具教程

要实现这个功能,只需要进入”Settings”->”Accounts”,你会看到”Get mail from other accounts”(从其它帐户收取邮件),再点击”Add another mail account”即可开始添加非Gmail邮件帐户,非常简单。需要更多详情,请点击这里看Gmail的帮助。

  在设置了这些非Gmail帐号后,你还可以在”Settings”->”Accounts”的”Send mail as:”设置你的不同发信地址,这样别人收到你的邮件时,看起来就像是从指定的邮箱发过来的。

  这是一个极重要的功能!不过,我们仍然要注意的是:  

  最多只能收取5个非Gmail邮箱的邮件,不过相信已经够用;

  指定收取邮件的非Gmail邮箱必须支持POP3并且已开启;

  目前只有部分Gmail邮箱才拥有这个功能,但很快就会向所有Gmail邮箱开放。

C#读取Outlook内容到Excel

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace MailAnalyze
{
    /**//// <summary>
    /// Summary description for Mainform.
    /// </summary>
    public class Mainform : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Button ConnectButton;
        private System.Windows.Forms.ListBox MailFolderList;
        private bool connOutlook = false;
        private System.Windows.Forms.TextBox FilterBox;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private ArrayList maillist = new ArrayList();
        private System.Windows.Forms.TabControl tabControl1;
        private System.Windows.Forms.TabPage tabPage1;
        private System.Windows.Forms.TabPage tabPage2;
        private System.Windows.Forms.TextBox BodyBox;
        private System.Windows.Forms.Button ExportBtn;
        private System.Windows.Forms.ListView QuestionListView;
        private System.Windows.Forms.ColumnHeader columnHeader1;
        private System.Windows.Forms.ColumnHeader columnHeader3;
        private System.Windows.Forms.ColumnHeader columnHeader4;
        private System.Windows.Forms.ColumnHeader columnHeader5;
        private System.Windows.Forms.Button QuitBtn;
        /**//// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public Mainform()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            MailFolderList.Items.Clear();
            label2.Text = “”;

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /**//// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /**//// <summary>
        /// Required method for Designer support – do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.ConnectButton = new System.Windows.Forms.Button();
            this.MailFolderList = new System.Windows.Forms.ListBox();
            this.FilterBox = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.BodyBox = new System.Windows.Forms.TextBox();
            this.ExportBtn = new System.Windows.Forms.Button();
            this.QuestionListView = new System.Windows.Forms.ListView();
            this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
            this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
            this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
            this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
            this.QuitBtn = new System.Windows.Forms.Button();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.tabPage2.SuspendLayout();
            this.SuspendLayout();
            //
            // ConnectButton
            //
            this.ConnectButton.Location = new System.Drawing.Point(232, 8);
            this.ConnectButton.Name = “ConnectButton”;
            this.ConnectButton.Size = new System.Drawing.Size(120, 24);
            this.ConnectButton.TabIndex = 0;
            this.ConnectButton.Text = “Access Outlook”;
            this.ConnectButton.Click += new System.EventHandler(this.ConnectButton_Click);
            //
            // MailFolderList
            //
            this.MailFolderList.HorizontalScrollbar = true;
            this.MailFolderList.Location = new System.Drawing.Point(8, 40);
            this.MailFolderList.Name = “MailFolderList”;
            this.MailFolderList.Size = new System.Drawing.Size(208, 381);
            this.MailFolderList.TabIndex = 1;
            this.MailFolderList.SelectedIndexChanged += new System.EventHandler(this.MailFolderList_SelectedIndexChanged);
            //
            // FilterBox
            //
            this.FilterBox.Location = new System.Drawing.Point(80, 10);
            this.FilterBox.Name = “FilterBox”;
            this.FilterBox.Size = new System.Drawing.Size(136, 20);
            this.FilterBox.TabIndex = 2;
            this.FilterBox.Text = “”;
            //
            // label1
            //
            this.label1.Location = new System.Drawing.Point(8, 14);
            this.label1.Name = “label1″;
            this.label1.Size = new System.Drawing.Size(64, 16);
            this.label1.TabIndex = 3;
            this.label1.Text = “Title Filter:”;
            //
            // label2
            //
            this.label2.Font = new System.Drawing.Font(“Microsoft Sans Serif”, 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
            this.label2.Location = new System.Drawing.Point(8, 424);
            this.label2.Name = “label2″;
            this.label2.Size = new System.Drawing.Size(100, 16);
            this.label2.TabIndex = 4;
            this.label2.Text = “label2″;
            //
            // tabControl1
            //
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Location = new System.Drawing.Point(232, 40);
            this.tabControl1.Name = “tabControl1″;
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(440, 384);
            this.tabControl1.TabIndex = 5;
            //
            // tabPage1
            //
            this.tabPage1.Controls.Add(this.BodyBox);
            this.tabPage1.Location = new System.Drawing.Point(4, 22);
            this.tabPage1.Name = “tabPage1″;
            this.tabPage1.Size = new System.Drawing.Size(432, 358);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = “Mailbody”;
            //
            // tabPage2
            //
            this.tabPage2.Controls.Add(this.QuestionListView);
            this.tabPage2.Location = new System.Drawing.Point(4, 22);
            this.tabPage2.Name = “tabPage2″;
            this.tabPage2.Size = new System.Drawing.Size(432, 358);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = “Question Analyze”;
            //
            // BodyBox
            //
            this.BodyBox.Location = new System.Drawing.Point(0, 0);
            this.BodyBox.Multiline = true;
            this.BodyBox.Name = “BodyBox”;
            this.BodyBox.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.BodyBox.Size = new System.Drawing.Size(432, 360);
            this.BodyBox.TabIndex = 0;
            this.BodyBox.Text = “”;
            //
            // ExportBtn
            //
            this.ExportBtn.Location = new System.Drawing.Point(368, 8);
            this.ExportBtn.Name = “ExportBtn”;
            this.ExportBtn.Size = new System.Drawing.Size(96, 23);
            this.ExportBtn.TabIndex = 6;
            this.ExportBtn.Text = “Export to Excel”;
            this.ExportBtn.Click += new System.EventHandler(this.ExportBtn_Click);
            //
            // QuestionListView
            //
            this.QuestionListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                                                                                               this.columnHeader1,
                                                                                               this.columnHeader3,
                                                                                               this.columnHeader4,
                                                                                               this.columnHeader5});
            this.QuestionListView.FullRowSelect = true;
            this.QuestionListView.GridLines = true;
            this.QuestionListView.Location = new System.Drawing.Point(0, 0);
            this.QuestionListView.MultiSelect = false;
            this.QuestionListView.Name = “QuestionListView”;
            this.QuestionListView.Size = new System.Drawing.Size(432, 360);
            this.QuestionListView.TabIndex = 0;
            this.QuestionListView.View = System.Windows.Forms.View.Details;
            //
            // columnHeader1
            //
            this.columnHeader1.Text = “MailID”;
            this.columnHeader1.Width = 42;
            //
            // columnHeader3
            //
            this.columnHeader3.Text = “Q No.”;
            this.columnHeader3.Width = 40;
            //
            // columnHeader4
            //
            this.columnHeader4.Text = “Question”;
            this.columnHeader4.Width = 280;
            //
            // columnHeader5
            //
            this.columnHeader5.Text = “Answer”;
            //
            // QuitBtn
            //
            this.QuitBtn.Location = new System.Drawing.Point(609, 8);
            this.QuitBtn.Name = “QuitBtn”;
            this.QuitBtn.Size = new System.Drawing.Size(64, 23);
            this.QuitBtn.TabIndex = 7;
            this.QuitBtn.Text = “Quit”;
            this.QuitBtn.Click += new System.EventHandler(this.QuitBtn_Click);
            //
            // Mainform
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(688, 442);
            this.Controls.Add(this.QuitBtn);
            this.Controls.Add(this.ExportBtn);
            this.Controls.Add(this.tabControl1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.FilterBox);
            this.Controls.Add(this.MailFolderList);
            this.Controls.Add(this.ConnectButton);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            this.Name = “Mainform”;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = “Site Survey Analysis Tool”;
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabPage2.ResumeLayout(false);
            this.ResumeLayout(false);

        }
        #endregion

        private void ConnectButton_Click(object sender, System.EventArgs e)
        {
            try
            {
                ConnectButton.Enabled = false;
                Outlook.ApplicationClass outLookApp = new Outlook.ApplicationClass();
                Outlook.NameSpace outlookNS = outLookApp.GetNamespace(“MAPI”);
                Outlook.MAPIFolder selectFolder = outlookNS.PickFolder();
                MailFolderList.Items.Clear();
                maillist.Clear();
                QuestionListView.Items.Clear();
                BodyBox.Text = string.Empty;
                int i=0;
                foreach(object item in selectFolder.Items)
                {
                    Outlook.MailItem mi = item as Outlook.MailItem;
                    if (FilterBox.Text.Trim()!=string.Empty)
                    {
                        if (mi.Subject.IndexOf(FilterBox.Text.Trim())>0)
                        {
                            i++;
                            MailFolderList.Items.Add(i.ToString()+”.”+mi.Subject+mi.ReceivedTime.ToString());
                            maillist.Add(mi);
                        }
                    }
                    else
                    {
                        i++;
                        MailFolderList.Items.Add(i.ToString()+”.”+mi.Subject+mi.ReceivedTime.ToString());
                        maillist.Add(mi);
                    }
                }
                label2.Text = “Total “+i.ToString()+” mails”;
                outLookApp = null;
                connOutlook = true;
            }
            catch
            {
                connOutlook = false;
                MessageBox.Show(“Can’t connect to Outlook!”);
            }
            finally
            {
                ConnectButton.Enabled = true;
            }

        }

        /**//// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.Run(new Mainform());
        }

        private void MailFolderList_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            try
            {
                int midx = MailFolderList.SelectedIndex;
                Outlook.MailItem mi = maillist[midx] as Outlook.MailItem;
                BodyBox.Text = mi.Body;
                QuestionListView.Items.Clear();
                try
                {
                    AnalyzeBody(midx+1,mi);
                }
                catch
                {
                    MessageBox.Show(“The mailbody don’t follow the format of Site Survey!”);
                }
            }
            catch
            {
                MessageBox.Show(“Can’t find this mail.”);
            }
        }

        private void AnalyzeBody(int midx,Outlook.MailItem mi)
        {
            string body = mi.Body;
            body = body.Replace(“\r\n”,”|”);
            string[] linearr = body.Split(‘|’);
            string currquestion = “”;
            string currmainquest = “”;
            string curranswer = “”;
            string currqnum = string.Empty;
            int secqnum = 0;
            foreach(string line in linearr)
            {
                if (line.IndexOf(‘Q’)>-1)
                {
                    //新的题目
                    if (line.StartsWith(“Q”))
                    {
                        currqnum = line.Substring(0,line.IndexOf(“:”));
                        currquestion = line.Remove(0,line.IndexOf(“:”)+1);
                        secqnum = 0;
                        if (currquestion.IndexOf(“Q”)>-1)
                        {
                            curranswer = “Q”+currquestion.Split(‘Q’)[1];
                            currquestion = currquestion.Split(‘Q’)[0];
                            //保存这个题目
                            ListViewItem listitem = new ListViewItem();
                            listitem.Text = midx.ToString();
                            listitem.SubItems.Add(currqnum);
                            listitem.SubItems.Add(currquestion);
                            listitem.SubItems.Add(curranswer);

                            QuestionListView.Items.Add(listitem);
                            currqnum = “”;
                            currquestion = “”;
                            curranswer = “”;

                        }
                        else
                        {
                            currmainquest = currquestion;
                            curranswer = “”;
                        }
                    }
                    else
                    {
                        //有子题目,分别保存
                        secqnum++;
                        curranswer += “Q”+line.Split(‘Q’)[1];
                        currquestion = currmainquest+”–”+line.Split(‘Q’)[0];
                        ListViewItem listitem = new ListViewItem();
                        listitem.Text = midx.ToString();
                        listitem.SubItems.Add(currqnum+”_”+secqnum.ToString());
                        listitem.SubItems.Add(currquestion);
                        listitem.SubItems.Add(curranswer);
                        QuestionListView.Items.Add(listitem);
                        currquestion = “”;
                        curranswer = “”;
                    }
                }
            }
        }

        private void ExportBtn_Click(object sender, System.EventArgs e)
        {
            if (connOutlook)
            {
                try
                {
                    string log = string.Empty;
                    tabControl1.TabIndex = 0;
                    ExportBtn.Enabled = false;
                    ConnectButton.Enabled = false;

                    ArrayList SurveyList = new ArrayList();

                    //导出记录到ArrayList中
                    if (maillist!=null && maillist.Count>0)
                    {
                        for (int i=0;i<maillist.Count;i++)
                        {
                            Outlook.MailItem mi = maillist[i] as Outlook.MailItem;
                            try
                            {
                                AnalyzeBody(i+1,mi);
                                //将listview中的内容导出
                                for (int j=0;j<QuestionListView.Items.Count;j++)
                                {
                                    SurveyQ sq = new SurveyQ();
                                    sq.Mailid = (i+1).ToString();
                                    sq.Mailtime = mi.ReceivedTime.ToString();
                                    sq.QNo = QuestionListView.Items[j].SubItems[1].Text;
                                    sq.Question = QuestionListView.Items[j].SubItems[2].Text;
                                    sq.Qanswer = QuestionListView.Items[j].SubItems[3].Text;
                                    SurveyList.Add(sq);
                                }

                            }
                            catch
                            {
                                log += “Mail:ID “+(i+1).ToString()+” didn’t match the survey format. Can’t export!\r\n”;
                            }
                        }
                    }
                    //将生成的list输出到Excel
                    if (SurveyList.Count>0)
                    {
                        string[,] SurveyArray = new string[SurveyList.Count,5];
                        for (int i=0;i<SurveyList.Count;i++)
                        {
                            SurveyQ sq = SurveyList[i] as SurveyQ;
                            SurveyArray[i,0] = sq.Mailid;
                            SurveyArray[i,1] = sq.Mailtime;
                            SurveyArray[i,2] = sq.QNo;
                            SurveyArray[i,3] = sq.Question;
                            SurveyArray[i,4] = sq.Qanswer;
                        }

                        Excel.ApplicationClass excelApp = new Excel.ApplicationClass();
                        Excel.Workbook workbook = excelApp.Workbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
                        Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets[1];
                        //标题
                        Excel.Range titlerange = worksheet.get_Range(“A1″,”E1″);
                        titlerange.Font.Bold = true;
                        titlerange.Value2 = new string[5] {“Mail ID”,”Receive Time”,”Question No.”,”Question”,”Answer”};

                        //正文
                        Excel.Range workrange = worksheet.get_Range(“A2″,”E”+(SurveyList.Count+1).ToString());
                        workrange.Value2 = SurveyArray;

                        excelApp.Visible = true;

                        titlerange = null;
                        workrange = null;
                        worksheet = null;
                        workbook = null;
                        excelApp = null;
                    }

                    if (log!=string.Empty)
                            MessageBox.Show(log);
                        else
                            MessageBox.Show(“Export successfully!”);
                    ExportBtn.Enabled = true;
                    ConnectButton.Enabled = true;

                }
                catch
                {
                    MessageBox.Show(“Can’t Export!”);
                }
            }
            else
            {
                MessageBox.Show(“Didn’t connect to Outlook!”);
            }
        }

        private void QuitBtn_Click(object sender, System.EventArgs e)
        {
            Application.Exit();
        }

        internal class SurveyQ
        {
            public string Mailid;
            public string Mailtime;
            public string QNo;
            public string Question;
            public string Qanswer;
           
            public SurveyQ()
            {
                Mailid = “”;
                Mailtime = “”;
                QNo = “”;
                Question = “”;
                Qanswer = “”;
            }
        }
   
    }
}

//////////

我们每天都可能需要收到很多的邮件,有些邮件是需要马上处理的,因此希望能在收到邮件之后马上就知道,但是有不希望频繁的去看有没有。OUTLOOK可以帮我们轻松做到新邮件到达提醒。

     设置outlook新邮件到达提醒:选项->电子邮件选项->高级电子邮件选项->选中新邮件到达桌面通知即可。
     另外,我们在使用这个功能的时候,必须保证outlook启动。outlook启动后最小化总是在任务栏上占一个位置,工作起来碍事,所以希望它能够最小化到托盘,以下方法可以帮你实现:
1.打开注册表 : 开始菜单 -> 运行, 输入”regedit”并回车
2.打开HKEY_CURRENT_USER\Software\Microsoft\Office\11.0(如果是Outlook XP,此处为10.0)\Outlook\Preferences项目
3.建立一个DWord的值(双字节值),名称为”MinToTray”, 取值改成 1
4.关闭注册表编辑器, 如果Outlook XP/2003运行中, 也关掉Outlook XP/2003.
5.启动Outlook XP/2003, 此时系统托盘区已经有一个Outlook XP/2003的小图标了, 当你把Outlook XP/2003最小化的时候, 它就会自己缩到托盘区了.