Skip to content

Commit

Permalink
DOCUMENTATION: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mabroukmahdhi committed Aug 12, 2024
1 parent ff96697 commit 176cf6f
Showing 1 changed file with 41 additions and 43 deletions.
84 changes: 41 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,49 @@ dotnet add package FlexiMail

## Usage

To use FlexiMail, follow the steps below:
To use **FlexiMail**, follow the steps below:

### Basic Example

```csharp
using FlexiMail;
using FlexiMail.Models.Configurations;
using FlexiMail.Models.Foundations.Bodies;
using FlexiMail.Models.Foundations.Messages;
public class EmailService
namespace FlexiMail.Sample
{
private readonly IFlexiMailClient flexiMailClient;
class Program
{
static async Task Main(string[] args)
{
var configurations = new ExchangeConfigurations
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
TenantId = "your-tenant-id",
Authority = "https://login.microsoftonline.com/{your-tenant-id}",
Scopes = ["https://outlook.office365.com/.default"],
SmtpAddress = "your-sender-email"
};
public EmailService(IFlexiMailClient flexiMailClient) =>
this.flexiMailClient = flexiMailClient;
var flexiMailClient = new FlexiMailClient(configurations);
public async Task SendWelcomeEmail(string recipientEmail)
{
var flexiMessage = new FlexiMessage()
var nessage = new FlexiMessage
{
Subject = "FlexiMail is a cool library",
To = [recipientEmail],
To = ["[email protected]"],
Cc = ["[email protected]"],
Subject = "Keep testing FlexiMail",
Body = new FlexiBody
{
Content = "<h3>Welcome to FlexiMail</h3><p>Bonjour tout le monde!</p>",
ContentType = BodyContentType.Html
Content = "This is the message body. It can be a plain text or HTML.",
ContentType = BodyContentType.PlainText
}
};
await this.flexiMailClient.SendAndSaveCopyAsync(flexiMessage);
await flexiMailClient.SendAndSaveCopyAsync(nessage);
Console.ReadKey();
}
}
}
```
Expand All @@ -80,20 +95,18 @@ configuration file:
```json
{
"ExchangeConfigurations": {
"ClientId": "your-client-id",
"ClientSecret": "your-client-secret",
"TenantId": "your-tenant-id",
"SmtpAddress": "your-smtp-address",
"Sid": "your-sid",
"PrincipalName": "your-principal-name",
"Authority": "your-authority",
"Scopes": [
"scope1",
"scope2",
"scope3"
]
}
"ExchangeConfigurations": {
"ClientId": "your-client-id",
"ClientSecret": "your-client-secret",
"TenantId": "your-tenant-id",
"SmtpAddress": "your-smtp-address",
"Sid": "your-sid",
"PrincipalName": "your-principal-name",
"Authority": "your-authority",
"Scopes": [
"https://outlook.office365.com/.default"
]
}
}
```
Expand All @@ -113,21 +126,6 @@ to [The-Standard](https://github.com/hassanhabib/The-Standard):
The main class, `FlexiMailClient`, implements the `IFlexiMailClient` interface and serves as the entry point for most
operations.
## Testing
Unit tests are provided to ensure the reliability of the **FlexiMail** library. The tests are located in the
`FlexiMail.Tests.Unit` and `FlexiMail.Test.Integration` projects.
### Running Tests
To run the tests, use the following command in the terminal:
```bash
dotnet test
```
Ensure that all dependencies are restored before running the tests.
## Contributing
Contributions to **FlexiMail** are welcome! Please follow these steps to contribute:
Expand Down

0 comments on commit 176cf6f

Please sign in to comment.