1- # 1. PandaTech.Communicator
2-
3- - [ 1. EasyRateLimiter] ( #1-easyratelimiter )
4- - [ 1.1. Introduction] ( #11-introduction )
5- - [ 1.2. Installation] ( #12-installation )
6- - [ 1.3. Setup] ( #13-setup )
7- - [ 1.3.1. Program.cs Example] ( #131-programcs-example )
8- - [ 1.3.1.1. Using WebApplicationBuilder] ( #1311-using-webapplicationbuilder )
9- - [ 1.3.1.2. Using IServiceCollection] ( #1312-using-iservicecollection )
10- - [ 1.3.2. Appsettings.json Example] ( #132-appsettingsjson-example )
11- - [ 1.4. Configuration Options Explained] ( #14-configuration-options-explained )
12- - [ 1.5. Usage] ( #15-usage )
13- - [ 1.5.1. Send SMS message] ( #151-send-sms-message )
14- - [ 1.5.2. Send Email message] ( #152-send-email-message )
15- - [ 1.6. Limitations] ( #16-limitations )
16- - [ 1.7. License] ( #17-license )
17-
18- ## 1.1. Introduction
1+ # PandaTech.Communicator
2+
3+ ## Introduction
194
205** PandaTech.Communicator** is aimed to send Email and SMS messages to the clients of your service where you use this
216library.
227
23- - ** Email:** By given setup it's easy and fast to configure and setup Email providers for later use by different
24- channels.
25- - ** SMS:** By given setup it's easy and fast to configure and setup already integrated SMS providers for later use by
26- different channels.
27- - ** Dexatel**
28- - ** Twilio**
8+ - ** Email:** By given setup it's easy and fast to configure and setup Email providers for later use by different
9+ channels.
10+ - ** SMS:** By given setup it's easy and fast to configure and setup already integrated SMS providers for later use by
11+ different channels.
12+ - ** Dexatel**
13+ - ** Twilio**
2914
3015This package is ideal for efficient and reliable messaging in any application.
3116
32- ## 1.2. Installation
17+ ## Installation
3318
3419Install this NuGet library directly from the IDE package installer or by following command:
3520
3621` dotnet add package PandaTech.Communicator `
3722
38- ## 1.3. Setup
23+ ## Setup
3924
4025To incorporate PandaTech.Communicator into your project, you have 2 primary methods to setup in your ` Program.cs ` :
4126
4227The first method directly using ` WebApplicationBuilder ` from which ` IConfiguration ` is directly used. But for the second
4328method builder is not accessible, so we pass ` IConfiguration ` into it as parameter.
4429
45- - ` builder.AddCommunicator(); `
46- - ` services.AddCommunicator(configuration); `
30+ - ` builder.AddCommunicator(); `
31+ - ` services.AddCommunicator(configuration); `
4732
4833Configuration options can be specified either in ` appsettings.json ` or directly in ` Program.cs ` , with the latter taking
4934precedence.
@@ -59,7 +44,7 @@ EmailChannels
5944 " MarketingSender" ,
6045 " SupportSender"
6146};
62-
47+
6348SmsChannels
6449{
6550 " GeneralSender" ,
@@ -73,11 +58,11 @@ SmsChannels
7358For each channel can be setup same provider, but it's recommended to have different sender, as they are dedicated for
7459different purposes.
7560
76- ### 1.3.1. Program.cs Example
61+ ### Program.cs Example
7762
7863In case of using SSL by setting UseSsl = true use port number 456, otherwise use 587 for non SSL connection.
7964
80- #### 1.3.1.1. Using ` WebApplicationBuilder `
65+ #### Using ` WebApplicationBuilder `
8166
8267``` csharp
8368builder .AddCommunicator (options =>
@@ -143,7 +128,7 @@ builder.AddCommunicator(options =>
143128
144129```
145130
146- #### 1.3.1.2. Using ` IServiceCollection `
131+ #### Using ` IServiceCollection `
147132
148133``` csharp
149134services .AddCommunicator (configuration , options =>
@@ -209,77 +194,77 @@ services.AddCommunicator(configuration, options =>
209194
210195```
211196
212- ### 1.3.2. Appsettings.json Example
197+ ### Appsettings.json Example
213198
214199``` json
215200{
216- "Logging" : {
217- "LogLevel" : {
218- "Default" : " Information" ,
219- "Microsoft.AspNetCore" : " Warning"
220- }
221- },
222- "Communicator" : {
223- "SmsFake" : false ,
224- "SmsConfigurations" : {
225- "GeneralSender" : {
226- "Provider" : " Dexatel" ,
227- "From" : " sender_name" ,
228- "Properties" : {
229- "X-Dexatel-Key" : " key"
230- },
231- "TimeoutMs" : " 10000"
232- },
233- "TransactionalSender" : {
234- "Provider" : " Twilio" ,
235- "From" : " sender_number" ,
236- "Properties" : {
237- "SID" : " key" ,
238- "AUTH_TOKEN" : " token"
239- },
240- "TimeoutMs" : " 10000"
241- }
201+ "Logging" : {
202+ "LogLevel" : {
203+ "Default" : " Information" ,
204+ "Microsoft.AspNetCore" : " Warning"
205+ }
242206 },
243- "EmailFake" : false ,
244- "EmailConfigurations" : {
245- "GeneralSender" : {
246- "SmtpServer" : " smtp.gmail.com" ,
247- "SmtpPort" : 465 , // 587
248- "SmtpUsername" : " vazgen" ,
249- "SmtpPassword" : " vazgen123" ,
250- "SenderEmail" :
" [email protected] " ,
251- "UseSsl" : true , // false
252- "TimeoutMs" : " 10000"
253- },
254- "TransactionalSender" : {
255- "SmtpServer" : " smtp.gmail.com" ,
256- "SmtpPort" : 465 , // 587
257- "SmtpUsername" : " vazgen" ,
258- "SmtpPassword" : " vazgen123" ,
259- "SenderEmail" :
" [email protected] " ,
260- "UseSsl" : true , // false
261- "TimeoutMs" : " 10000"
262- }
207+ "Communicator" : {
208+ "SmsFake" : false ,
209+ "SmsConfigurations" : {
210+ "GeneralSender" : {
211+ "Provider" : " Dexatel" ,
212+ "From" : " sender_name" ,
213+ "Properties" : {
214+ "X-Dexatel-Key" : " key"
215+ },
216+ "TimeoutMs" : " 10000"
217+ },
218+ "TransactionalSender" : {
219+ "Provider" : " Twilio" ,
220+ "From" : " sender_number" ,
221+ "Properties" : {
222+ "SID" : " key" ,
223+ "AUTH_TOKEN" : " token"
224+ },
225+ "TimeoutMs" : " 10000"
226+ }
227+ },
228+ "EmailFake" : false ,
229+ "EmailConfigurations" : {
230+ "GeneralSender" : {
231+ "SmtpServer" : " smtp.gmail.com" ,
232+ "SmtpPort" : 465 , // 587
233+ "SmtpUsername" : " vazgen" ,
234+ "SmtpPassword" : " vazgen123" ,
235+ "SenderEmail" :
" [email protected] " ,
236+ "UseSsl" : true , // false
237+ "TimeoutMs" : " 10000"
238+ },
239+ "TransactionalSender" : {
240+ "SmtpServer" : " smtp.gmail.com" ,
241+ "SmtpPort" : 465 , // 587
242+ "SmtpUsername" : " vazgen" ,
243+ "SmtpPassword" : " vazgen123" ,
244+ "SenderEmail" :
" [email protected] " ,
245+ "UseSsl" : true , // false
246+ "TimeoutMs" : " 10000"
247+ }
248+ }
263249 }
264- }
265250}
266251```
267252
268253The configuration options in ` appsettings.json ` and ` program.cs ` (priority) are identical.
269254
270- ## 1.4. Configuration Options Explained
255+ ## Configuration Options Explained
271256
272- - ** Communicator:** Global settings for PandaTech.Communicator
273- - ** SmsFake:** This setup is for fake SMS service to be used which doesn't send real SMS messages and just return
274- ` TTask.CompletedTask ` .
275- - ** SmsConfigurations:** SMS configurations given by ` appsettings.json ` or via ` builder.AddCommunicator() ` options for
276- SMS.
277- - ** EmailFake:** This setup is for fake Email service to be used which doesn't send real SMS messages and just return
278- ` TTask.CompletedTask ` .
279- - ** EmailConfigurations:** Email configurations given by ` appsettings.json ` or via ` builder.AddCommunicator() ` options
280- for Email.
257+ - ** Communicator:** Global settings for PandaTech.Communicator
258+ - ** SmsFake:** This setup is for fake SMS service to be used which doesn't send real SMS messages and just return
259+ ` TTask.CompletedTask ` .
260+ - ** SmsConfigurations:** SMS configurations given by ` appsettings.json ` or via ` builder.AddCommunicator() ` options for
261+ SMS.
262+ - ** EmailFake:** This setup is for fake Email service to be used which doesn't send real SMS messages and just return
263+ ` TTask.CompletedTask ` .
264+ - ** EmailConfigurations:** Email configurations given by ` appsettings.json ` or via ` builder.AddCommunicator() ` options
265+ for Email.
281266
282- ## 1.5. Usage
267+ ## Usage
283268
284269In order to use the library, you need to generate ` SmsMessage ` or ` EmailMessage ` and use one of the interfaces mentioned
285270above for the service you need to use.
@@ -314,8 +299,8 @@ Channel is set by `EmailChannels` or by `SmsChannels` classes with constant valu
314299There are 2 interfaces ` ISmsService ` and ` IEmailService ` responsible for individual cases SMS or Email.
315300Methods for sending SMS/Email messages are:
316301
317- - ** SendAsync:**
318- - ** SendBulkAsync:**
302+ - ** SendAsync:**
303+ - ** SendBulkAsync:**
319304
320305The structure of the service interfaces are shown below.
321306
@@ -333,7 +318,7 @@ public interface IEmailService
333318}
334319```
335320
336- ## 1.5.1. Send SMS message
321+ ## Send SMS message
337322
338323``` csharp
339324var sms = new SmsMessage
@@ -363,7 +348,7 @@ public class GeneralSmsResponse
363348}
364349```
365350
366- ## 1.5.2. Send Email message
351+ ## Send Email message
367352
368353``` csharp
369354var email = new EmailMessage
@@ -386,10 +371,10 @@ email providers, so you can create your ouw return type and map returned string
3863712.0.0 OK 8ONXSST18NU4.DSCFVS8PQ0Q13@test AM0PR08MB5346.eurprd08.prod.outlook.com
387372```
388373
389- ## 1.6. Limitations
374+ ## Limitations
390375
391376PandaTech.Communicator works with all Email providers, but with only with existing integrations for SMS listed above.
392377
393- ## 1.7. License
378+ ## License
394379
395- PandaTech.Communicator is licensed under the MIT License.
380+ PandaTech.Communicator is licensed under the MIT License.
0 commit comments