1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Globalization ;
4+ using System . Threading . Tasks ;
5+ using Pepipost ;
6+ using Pepipost . Utilities ;
7+ using Pepipost . Models ;
8+ using Pepipost . Controllers ;
9+ using Pepipost . Exceptions ;
10+ using System . IO ;
11+
12+ namespace TestAPI
13+ {
14+ class Program
15+ {
16+ static void Main ( string [ ] args )
17+ {
18+ Configuration . ApiKey = "api_key" ;
19+ PepipostClient client = new PepipostClient ( ) ;
20+ MailSendController mailSend = client . MailSend ;
21+ Send body = new Send ( ) ;
22+ body . From = new From ( ) ;
23+ body . From . Email = "hello@registered-domain.in" ;
24+ body . From . Name = "Pepipost" ;
25+ body . Subject = "Pepipost Test Mail from SDK" ;
26+ body . Content = new List < Content > ( ) ;
27+ Content body_content_0 = new Content ( ) ;
28+ body_content_0 . Type = TypeEnum . HTML ;
29+ body_content_0 . Value = "<html><body>Hello, Welcome to Pepipost Family.<br>My name is [% name %].<br>my love is sending [% love %]</body> <br></html>" ;
30+ body . Content . Add ( body_content_0 ) ;
31+ body . Personalizations = new List < Personalizations > ( ) ;
32+ Personalizations body_personalizations_0 = new Personalizations ( ) ;
33+ body_personalizations_0 . Attributes = APIHelper . JsonDeserialize < Object > ( "{\" name\" :\" Pepi\" ,\" love\" :\" Email\" }" ) ;
34+ body_personalizations_0 . Attachments = new List < Attachments > ( ) ;
35+ Attachments body_personalizations_0_attachments_0 = new Attachments ( ) ;
36+ body_personalizations_0_attachments_0 . Content = "SGVsbG8sIHRoaXMgZmlsZSBpcyBhbiBpbmZvcm1hdGlvbmFsIGZpbGU6OiBTZW5kaW5nIGVtYWlscyB0byB0aGUgaW5ib3ggaXMgd2hhdCB3ZSBkbywgYnV0IHRoYXTigJlzIG5vdCB0aGUgb25seSByZWFzb24gd2h5IGRldmVsb3BlcnMgYW5kIGVudGVycHJpc2VzIGxvdmUgdXMuIFdlIGFyZSB0aGUgb25seSBFU1AgdGhhdCBkb2VzbuKAmXQgY2hhcmdlIGZvciBlbWFpbHMgb3BlbmVkLg==" ;
37+ body_personalizations_0_attachments_0 . Name = "personalized-file.txt" ;
38+ body_personalizations_0 . Attachments . Add ( body_personalizations_0_attachments_0 ) ;
39+ body_personalizations_0 . To = new List < EmailStruct > ( ) ;
40+ EmailStruct body_personalizations_0_to_0 = new EmailStruct ( ) ;
41+ body_personalizations_0_to_0 . Name = "Vikram Sahu" ;
42+ body_personalizations_0_to_0 . Email = "to-address@gmail.com" ;
43+ body_personalizations_0 . To . Add ( body_personalizations_0_to_0 ) ;
44+ body_personalizations_0 . Cc = new List < EmailStruct > ( ) ;
45+ body_personalizations_0 . Bcc = new List < EmailStruct > ( ) ;
46+ body . Personalizations . Add ( body_personalizations_0 ) ;
47+ body . Tags = new List < string > ( ) ;
48+ body . Tags . Add ( "campaign" ) ;
49+ try
50+ {
51+ object result = mailSend . CreateGeneratethemailsendrequestAsync ( body ) . Result ;
52+ Console . WriteLine ( result ) ;
53+ }
54+ catch ( APIException e ) { } ;
55+ }
56+ }
57+ }
0 commit comments