Skip to content

Commit

Permalink
Merge pull request #568 from SharebookBR/develop
Browse files Browse the repository at this point in the history
Try fix IMAP error
  • Loading branch information
raffacabofrio authored Sep 30, 2024
2 parents 487ac0f + 2038c94 commit 656ecd3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/postman-collection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Postman collection validations

on:
workflow_dispatch:

jobs:
run-postman-collection-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Postman collection - Development environment
uses: matt-ball/newman-action@master
with:
collection: ShareBook API - Tests.postman_collection.json
delayRequest: 2000
envVar: '[{ "key": "sharebookUrl", "value": "https://dev.sharebook.com.br/" }, { "key": "sharebookEmail", "value": "[email protected]" }, { "key": "sharebookPassword", "value": "123456" }]'
# TODO: Add a job for production environment which must get username and password from github secrets
33 changes: 27 additions & 6 deletions ShareBook API - Tests.postman_collection.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "f7913a70-c6f4-4636-86a3-347efa40216f",
"_postman_id": "4a0b707e-0039-4e40-8fbe-17d85d626c63",
"name": "ShareBook API - Tests",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "29881360"
Expand Down Expand Up @@ -583,7 +583,7 @@
],
"body": {
"mode": "raw",
"raw": "{\r\n\t\"email\": \"[email protected]\",\r\n\t\"password\"\"123456\"\r\n}",
"raw": "{\r\n\t\"email\": \"{{sharebookEmail}}\",\r\n\t\"password\"\"{{sharebookPassword}}\"\r\n}",
"options": {
"raw": {
"language": "json"
Expand Down Expand Up @@ -891,13 +891,34 @@
"type": "text/javascript",
"packages": {},
"exec": [
"\r",
"console.log('Setting up...')\r",
"\r",
"const sharebookUrlName = 'sharebookUrl'\r",
"if (pm.globals.has(sharebookUrlName))\r",
" console.log(`Running using ${pm.globals.get(sharebookUrlName)}`)\r",
"if (pm.environment.has(sharebookUrlName))\r",
" console.log(`Running with ${sharebookUrlName} ${pm.environment.get(sharebookUrlName)}`)\r",
"else {\r",
" const fallbackUrl = 'https://dev.sharebook.com.br/'\r",
" console.log(`The global variable ${sharebookUrlName} isn't found. Using ${fallbackUrl} as default value... `)\r",
" pm.globals.set(sharebookUrlName, fallbackUrl)\r",
" console.log(`The environment variable ${sharebookUrlName} isn't found. Using ${fallbackUrl} as default value... `)\r",
" pm.environment.set(sharebookUrlName, fallbackUrl)\r",
"}\r",
"\r",
"const sharebookEmailName = 'sharebookEmail';\r",
"if (pm.environment.has(sharebookEmailName))\r",
" console.log(`Running with ${sharebookEmailName} : ${pm.environment.get(sharebookEmailName)}`)\r",
"else {\r",
" const fallBackEmail = '[email protected]'\r",
" console.log(`The environment variable ${sharebookEmailName} isn't found. Using ${fallBackEmail} as default value... `)\r",
" pm.environment.set(sharebookEmailName, fallBackEmail)\r",
"}\r",
"\r",
"const sharebookPasswordName = 'sharebookPassword';\r",
"if (pm.environment.has(sharebookPasswordName))\r",
" console.log(`Running with ${sharebookPasswordName} : ${pm.environment.get(sharebookPasswordName)}`)\r",
"else {\r",
" const fallBackPassword = '123456'\r",
" console.log(`The environment variable ${sharebookPasswordName} isn't found. Using ${fallBackPassword} as default value... `)\r",
" pm.environment.set(sharebookPasswordName, fallBackPassword)\r",
"}"
]
}
Expand Down
2 changes: 1 addition & 1 deletion ShareBook/ShareBook.Service/Email/EmailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public async Task<IList<string>> ProcessBounceMessagesAsync()
return log;
}

await _imapClient.ConnectAsync(_settings.HostName, _settings.ImapPort, true);
await _imapClient.ConnectAsync(_settings.HostName, _settings.ImapPort, _settings.UseSSL);
await _imapClient.AuthenticateAsync(_settings.Username, _settings.Password);

var bounceFolder = await GetBounceFolderAsync();
Expand Down

0 comments on commit 656ecd3

Please sign in to comment.