private SendSmsResult sendSms(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapterWs.MailAdapter(); String dateTime = DateTime.Now.ToShortTimeString(); return dialogueService.sendSMS(apiKey, "13671935968", dateTime, "Hello World"); }
private String sendSingleMail(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapterWs.MailAdapter(); String fromName = "周安平"; String fromAddress = "*****@*****.**"; String subject = "51Job祝您生日快乐! "; String reportReceiveAddress = "*****@*****.**"; String mailBody = System.IO.File.ReadAllText("../../Example/template.html"); 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; return dialogueService.sendSingleEmail(apiKey, fromName, fromAddress, subject, reportReceiveAddress, mailBody, ContactInfos); }
private String registerContact(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapterWs.MailAdapter(); 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; return dialogueService.registerContact(apiKey, ContactInfos); }
private String publishingSmallScaleEmail(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapterWs.MailAdapter(); String fromName = "51Job"; String fromAddress = "*****@*****.**"; String subject = "${contact.username},51Job祝您生日快乐! "; String reportReceiveAddress = "*****@*****.**"; String mailBody = System.IO.File.ReadAllText("../../Example/template.html"); ContactFileInfo contactFileInfo = new ContactFileInfo(); contactFileInfo.fileType = fileExtension.CSV; contactFileInfo.filename = "Contacts.csv"; contactFileInfo.csvDilimiter = ";"; contactFileInfo.fileContent = System.IO.File.ReadAllBytes("../../Example/Contacts.csv"); return dialogueService.publishingSmallScaleEmail(apiKey, contactFileInfo, fromName, fromAddress, subject, reportReceiveAddress, mailBody); }
private String publishingBulkEmail(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapterWs.MailAdapter(); String fromName = "周安平"; String fromAddress = "*****@*****.**"; String subject = "publishingBulkEmail邮件测试"; String reportReceiveAddress = "*****@*****.**"; String mailBody = "Hello World"; String contactFileName = "Contact.csv"; return dialogueService.publishingBulkEmail(apiKey, contactFileName, fromName, fromAddress, subject, reportReceiveAddress, mailBody); }
private void exportReport(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapter(); DateTime endTime = DateTime.Now; DateTime startTime = endTime.AddHours(-8); CSVReportData reportData = dialogueService.exportReport(apiKey, startTime, endTime); Console.WriteLine("++++++++++++sent++++++++++++++"); Console.WriteLine(reportData.sent); Console.WriteLine("++++++++++++Opened++++++++++++++"); Console.WriteLine(reportData.opened); Console.WriteLine("++++++++++++clicked++++++++++++++"); Console.WriteLine(reportData.clicked); Console.WriteLine("++++++++++++bounced++++++++++++++"); Console.WriteLine(reportData.bounced); }
private void getRerportByJobId(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapter(); DateTime endTime = DateTime.Now; DateTime startTime = endTime.AddHours(-8); String publishId = "MTA1MzU3NDKMdCDprzC_oRpaAAO2LvZr"; ReportData reportData = dialogueService.getRerportByJobId(apiKey,publishId, startTime, endTime); Console.WriteLine("++++++++++++sent++++++++++++++"); Console.WriteLine(reportData.sent.Length); Console.WriteLine("++++++++++++Opened++++++++++++++"); Console.WriteLine(reportData.opened.Length); Console.WriteLine("++++++++++++clicked++++++++++++++"); Console.WriteLine(reportData.clicked.Length); Console.WriteLine("++++++++++++bounced++++++++++++++"); Console.WriteLine(reportData.bounced.Length); }
private void exportReportToFtp(String apiKey) { MailAdapterWs.MailAdapter dialogueService = new MailAdapter(); DateTime endTime = DateTime.Now; DateTime startTime = endTime.AddHours(-8); dialogueService.exportReportToFtp(apiKey, "FTP_", startTime, endTime); }