Exemple #1
0
        private void sendEmail(String emailId)
        {
            String client = Settings.Default.TripolisClient;
            String userName = Settings.Default.TripoisUserName;
            String password = Settings.Default.TripolisPassword;
            ChinaUnionAdapter mailAdapter = new ChinaUnionAdapter(client, userName, password, null);
            MailData mailData = new MailData();
            mailData.fromAddress = Settings.Default.MailFromAddress;
            mailData.replyAddress = Settings.Default.MailReplyAddress;
            mailData.sender = Settings.Default.MailSender;
            mailData.subject = "扫一扫,加入上海联通合作伙伴微信平台";

            String databaseId = Settings.Default.TripolisDBId;
            String workspaceId = Settings.Default.TripolisWorkspaceId;
            String emailTypeId = Settings.Default.TripolisEmailTypeId;

            String FilePath = Application.StartupPath + @"\BarcodeNotification.html";
            String content = System.IO.File.ReadAllText(FilePath, Encoding.UTF8);

            String message = mailAdapter.sendSingleEmail(databaseId, workspaceId, emailTypeId, Settings.Default.TripolisEmailId, mailData.sender, mailData.fromAddress, emailId, "Test", mailData.subject, content);


        }
Exemple #2
0
        private void btnSendTestMail_Click(object sender, EventArgs e)
        {
            try
            {
                frmMailAddress frmMailAddress = new frmMailAddress();
                frmMailAddress.subject = "测试:" + Settings.Default.MailSubject + "(" + this.feeMonth + ")";
                DialogResult dialogResult = frmMailAddress.ShowDialog();
                if (dialogResult == DialogResult.OK)
                {
                    String email = frmMailAddress.email;
                    String subject = frmMailAddress.subject;
                    if (!String.IsNullOrEmpty(email) && !String.IsNullOrWhiteSpace(email))
                    {

                        Cursor.Current = Cursors.WaitCursor;

                        String client = Settings.Default.TripolisClient;
                        String userName = Settings.Default.TripoisUserName;
                        String password = Settings.Default.TripolisPassword;

                        ChinaUnionAdapter mailAdapter = new ChinaUnionAdapter(client, userName, password, null);
                        MailData mailData = new MailData();
                        mailData.fromAddress = Settings.Default.MailFromAddress;
                        mailData.replyAddress = Settings.Default.MailReplyAddress;
                        mailData.sender = Settings.Default.MailSender;
                        mailData.subject = subject;

                        String databaseId = Settings.Default.TripolisDBId;
                        String workspaceId = Settings.Default.TripolisWorkspaceId;
                        String emailTypeId = Settings.Default.TripolisEmailTypeId;

                        String message = mailAdapter.sendSingleEmail(databaseId, workspaceId, emailTypeId,null,mailData.sender, mailData.fromAddress, email,"Test", mailData.subject, this.webBrowser1.DocumentText);

                        if (message.Contains("OK:"))
                        {

                           
                            MessageBox.Show("邮件发送完成");


                        }
                        else
                        {
                            MessageBox.Show(message);
                        }

                        Cursor.Current = Cursors.Default;

                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }