You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**PandaTech.Communicator** is aimed to send Email and SMS messages to the clients of your service where you use this library.
20
19
21
-
-**Email:** By given setup it's easy and fast to configure and setup Email providers for later use by different channels.
22
-
-**SMS:** By given setup it's easy and fast to configure and setup already integrated SMS providers for later use by different channels.
23
-
-**Dexatel**
24
-
-**Twilio**
20
+
**PandaTech.Communicator** is aimed to send Email and SMS messages to the clients of your service where you use this
21
+
library.
22
+
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**
25
29
26
30
This package is ideal for efficient and reliable messaging in any application.
27
31
28
32
## 1.2. Installation
29
33
30
-
Install this NuGet library directly from the IDE package installer or by following command:
34
+
Install this NuGet library directly from the IDE package installer or by following command:
31
35
32
36
`dotnet add package PandaTech.Communicator`
33
37
34
38
## 1.3. Setup
35
39
36
40
To incorporate PandaTech.Communicator into your project, you have 2 primary methods to setup in your `Program.cs`:
37
41
38
-
The first method directly using `WebApplicationBuilder` from which `IConfiguration` is directly used. But for the second method builder is not accessible, so we pass `IConfiguration` into it as parameter.
42
+
The first method directly using `WebApplicationBuilder` from which `IConfiguration` is directly used. But for the second
43
+
method builder is not accessible, so we pass `IConfiguration` into it as parameter.
44
+
39
45
-`builder.AddCommunicator();`
40
46
-`services.AddCommunicator(configuration);`
41
47
42
-
Configuration options can be specified either in `appsettings.json` or directly in `Program.cs`, with the latter taking precedence.
48
+
Configuration options can be specified either in `appsettings.json` or directly in `Program.cs`, with the latter taking
49
+
precedence.
43
50
44
51
There are several supported channels which must be kept during setup:
45
52
@@ -63,13 +70,15 @@ SmsChannels
63
70
};
64
71
```
65
72
66
-
For each channel can be setup same provider, but it's recommended to have different sender, as they are dedicated for different purposes.
73
+
For each channel can be setup same provider, but it's recommended to have different sender, as they are dedicated for
74
+
different purposes.
67
75
68
76
### 1.3.1. Program.cs Example
69
77
70
-
In case of using SSL by setting UseSsl = true use port number 456, otherwise use 587 for non SSL connection.
78
+
In case of using SSL by setting UseSsl = true use port number 456, otherwise use 587 for non SSL connection.
The configuration options in `appsettings.json` and `program.cs` (priority) are identical.
259
269
260
270
## 1.4. Configuration Options Explained
261
271
262
272
-**Communicator:** Global settings for PandaTech.Communicator
263
-
-**SmsFake:** This setup is for fake SMS service to be used which doesn't send real SMS messages and just return `TTask.CompletedTask`.
264
-
-**SmsConfigurations:** SMS configurations given by `appsettings.json` or via `builder.AddCommunicator()` options for SMS.
265
-
-**EmailFake:** This setup is for fake Email service to be used which doesn't send real SMS messages and just return `TTask.CompletedTask`.
266
-
-**EmailConfigurations:** Email configurations given by `appsettings.json` or via `builder.AddCommunicator()` options for Email.
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.
267
281
268
282
## 1.5. Usage
269
283
270
-
In order to use the library, you need to generate `SmsMessage` or `EmailMessage` and use one of the interfaces mentioned above for the service you need to use.
284
+
In order to use the library, you need to generate `SmsMessage` or `EmailMessage` and use one of the interfaces mentioned
285
+
above for the service you need to use.
271
286
272
287
Both of them support multiple recipients.
273
288
@@ -298,8 +313,9 @@ Channel is set by `EmailChannels` or by `SmsChannels` classes with constant valu
298
313
299
314
There are 2 interfaces `ISmsService` and `IEmailService` responsible for individual cases SMS or Email.
300
315
Methods for sending SMS/Email messages are:
301
-
-**SendAsync:**
302
-
-**SendBulkAsync:**
316
+
317
+
-**SendAsync:**
318
+
-**SendBulkAsync:**
303
319
304
320
The structure of the service interfaces are shown below.
305
321
@@ -329,9 +345,9 @@ var sms = new SmsMessage
329
345
awaitsmsService.SendAsync(sms);
330
346
```
331
347
332
-
Sms service returns general response which includes general properties in already integrated services.
348
+
Sms service returns general response which includes general properties in already integrated services.
333
349
334
-
Both methods return `List<GeneralSmsResponse>` when you use them while sending sms.
350
+
Both methods return `List<GeneralSmsResponse>` when you use them while sending sms.
335
351
If you set a variable to the call, you will be able to use returned response.
336
352
337
353
```csharp
@@ -360,8 +376,11 @@ var email = new EmailMessage
360
376
};
361
377
awaitemailService.SendAsync(email);
362
378
```
363
-
Both methods return response (SendAsync - `string`; SendBulkAsync - `List<string>`) when you use them while sending email.
364
-
If you set a variable to the call, you will be able to use returned response. Response structure varies on different email providers, so you can create your ouw return type and map returned string into it.
379
+
380
+
Both methods return response (SendAsync - `string`; SendBulkAsync - `List<string>`) when you use them while sending
381
+
email.
382
+
If you set a variable to the call, you will be able to use returned response. Response structure varies on different
383
+
email providers, so you can create your ouw return type and map returned string into it.
365
384
366
385
```text
367
386
2.0.0 OK 8ONXSST18NU4.DSCFVS8PQ0Q13@test AM0PR08MB5346.eurprd08.prod.outlook.com
0 commit comments