Beispiel #1
0
        public String registerContact(String apiKey, KeyValuePair[] ContactInfos)
        {
            DialogueSettingDao DialogueSettingDao = new DialogueSettingDao();
            DialogueSettingBO DB_DialogueSetting = DialogueSettingDao.Get(apiKey);

            Authorization authorization = new Authorization();
            authorization.client = DB_DialogueSetting.client;
            authorization.username = DB_DialogueSetting.username;
            authorization.password = DB_DialogueSetting.password;

            DialogueSetting dialogueSetting = new DialogueSetting();
            dialogueSetting.contactDatabaseId = DB_DialogueSetting.contactDatabaseId;
            dialogueSetting.workspaceId = DB_DialogueSetting.workspaceId;
            dialogueSetting.directEmailId = DB_DialogueSetting.directEmailId;

            DialogueService_new dialogueService_new = new DialogueService_new(authorization.client, authorization.username, authorization.password, null);
            return dialogueService_new.registerContact(dialogueSetting, ContactInfos);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //String client = "IPSOS API";//Training";
            //String userName = "******";//[email protected]";
            //String password = "******";
            //String databaseID = "MjUyMTI1MjHJ69MSWqS6mQ";
            //String ftpAccountId = "NTQwNTQwNTQQosYwP6thgg";

            String client = "Training";
            String userName = "******";
            String password = "******";
           // String databaseID = "MjU4MDI1ODCzAn45YUUpJw";//"MjU1MTI1NTFFUVus6S83qA";


            //String client = "51job";
            //String userName = "******";
            //String password = "******";
            //String databaseID = "MjU1ODI1NTgL21MIxlZDCQ";
            //String ftpAccountId = "NTM4NTM4NTMEfaWC25Hk0Q";
            DialogueService_new dialogueService = new DialogueService_new(client, userName, password, null);

            //String mailJobId = "MTA0ODQyOTKMdCDprzC_oRpaAAO2LvZr";
            //String databaseID = "MjU1ODI1NTgL21MIxlZDCQ";
          

            DateTime startTime = DateTime.Now.AddDays(-1);
            DateTime endTime = DateTime.Now;

          
           //dialogueService.exportReportToFtp(databaseID,ftpAccountId, startTime, endTime,ReportType.SENT);

           ReportData mailReport =  dialogueService.getRerportByJobId("MTA1MzU3NDKMdCDprzC_oRpaAAO2LvZr", startTime, endTime);
            

            Console.WriteLine("Sent**********************");
            Console.WriteLine(mailReport.sent);

            Console.WriteLine("opened**********************");
            Console.WriteLine(mailReport.opened);

            Console.WriteLine("clicked**********************");
            Console.WriteLine(mailReport.clicked);

            Console.WriteLine("bounced**********************");
            Console.WriteLine(mailReport.bounced);

            Console.ReadLine();
           


            DialogueSetting dialogueSetting = new DialogueSetting();
            dialogueSetting.contactDatabaseId = "MjU1MTI1NTFFUVus6S83qA";
            dialogueSetting.workspaceId = "MjAwNzIwMDdKRmT4g3bWOg";
            dialogueSetting.emailTypeId = "MTc2MDE3NjBcUp_pC*h71w";
            
            DirectEmail directEmail = new DirectEmail();
            String sequence = DateTime.Now.ToString("yyyyMMddHHmmssfffffff");
            directEmail.emailLabel = sequence;
            directEmail.emailName = sequence;
            directEmail.subject = "单个邮件测试";
            directEmail.description = "API邮件测试";
            directEmail.fromName = "周安平";
            directEmail.fromAddress = "*****@*****.**";
            directEmail.reportReceiveAddress = "*****@*****.**";
            directEmail.htmlContent = "Hello World";

            KeyValuePair[] ContactInfos = new KeyValuePair[3];

            KeyValuePair ContactInfo = new KeyValuePair();
            ContactInfo.key = "email";
            ContactInfo.value = "*****@*****.**";
            ContactInfos[0] = ContactInfo;
            ContactInfo = new KeyValuePair();
            ContactInfo.key = "username";
            ContactInfo.value = "周安平";
            ContactInfos[1] = ContactInfo;
            ContactInfo = new KeyValuePair();
            ContactInfo.key = "password";
            ContactInfo.value = "12234234";
            ContactInfos[2] = ContactInfo;
            directEmail.subject = "单个邮件测试";
            dialogueService.sendSingleEmail(dialogueSetting, directEmail, ContactInfos);

            dialogueSetting.directEmailId = "MzczMDk1Mzc98HDFHcJFcg";
            directEmail.subject = "注册邮件测试";
            dialogueService.registerContact(dialogueSetting, ContactInfos);


            ContactGroup contactGroup = new ContactGroup();
            contactGroup.groupLabel = "Demo Group";
            contactGroup.groupName = "demogroup1";

            ContactFileInfo importFiles = new ContactFileInfo();
            importFiles.fileType = cn.tripolis.dialogue.import.fileExtension.CSV;
            importFiles.filename = "Contacts.csv";
            importFiles.csvDilimiter = ContactFileInfo.DEFAULT_CSV_DELIMIT;
            importFiles.fileContent = System.IO.File.ReadAllBytes("../../Example/Contacts.csv");
            directEmail.subject = "小批量邮件测试";
            dialogueService.publishingSmallScaleEmail(dialogueSetting, contactGroup, importFiles, directEmail);


            dialogueSetting.ftpAccountId = "NTM5NTM5NTNW_uqPXJDMzQ";
            directEmail.subject = "大批量邮件测试";
            dialogueService.publishingBulkEmail(dialogueSetting, contactGroup, "Contacts.xls", directEmail);

            System.Console.WriteLine("Finish Action");
            System.Console.ReadLine();
        }