Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Rnwood.Smtp4dev/ClientApp/src/ApiClient/MessagesController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ export default class MessagesController {
}

// put: api/Messages
public import_url(mailboxName: string): string {
return `${this.apiBaseUrl}?mailboxName=${encodeURIComponent(mailboxName)}`;
public import_url(mailboxName: string, folderName: string = "INBOX"): string {
return `${this.apiBaseUrl}?mailboxName=${encodeURIComponent(mailboxName)}&folderName=${encodeURIComponent(folderName)}`;
}

public async import(emlContent: string, mailboxName: string): Promise<string> {
return (await axios.put(this.import_url(mailboxName), emlContent, {
public async import(emlContent: string, mailboxName: string, folderName: string = "INBOX"): Promise<string> {
return (await axios.put(this.import_url(mailboxName, folderName), emlContent, {
headers: {
'Content-Type': 'message/rfc822'
}
Expand Down
2 changes: 1 addition & 1 deletion Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,38 @@
<div class="toolbar">


<el-button
v-on:click="composeDialogVisible=true"
:disabled="!isRelayAvailable"
title="Compose">Compose</el-button>

Check warning on line 14 in Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <el-button> tag.

See more on https://sonarcloud.io/project/issues?id=rnwood_smtp4dev&issues=AZ1hzA3KV80h1QdmN00b&open=AZ1hzA3KV80h1QdmN00b&pullRequest=2104

<el-button
v-on:click="showFileSelector"
icon="Upload"
:disabled="!selectedMailbox"
title="Import EML files">Import</el-button>

Check warning on line 20 in Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <el-button> tag.

See more on https://sonarcloud.io/project/issues?id=rnwood_smtp4dev&issues=AZ1hzA3KV80h1QdmN00c&open=AZ1hzA3KV80h1QdmN00c&pullRequest=2104

<el-button-group>
<el-button icon="Delete"
v-on:click="deleteSelected"
:disabled="!selectedmessage"
title="Delete">Delete</el-button>

Check warning on line 26 in Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <el-button> tag.

See more on https://sonarcloud.io/project/issues?id=rnwood_smtp4dev&issues=AZ1hzA3KV80h1QdmN00d&open=AZ1hzA3KV80h1QdmN00d&pullRequest=2104

<el-button v-on:click="relaySelected"
icon="d-arrow-right"
:disabled="!selectedmessage || !isRelayAvailable"
:loading="isRelayInProgress"
title="Relay">Relay...</el-button>

Check warning on line 32 in Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <el-button> tag.

See more on https://sonarcloud.io/project/issues?id=rnwood_smtp4dev&issues=AZ1hzA3KV80h1QdmN00e&open=AZ1hzA3KV80h1QdmN00e&pullRequest=2104
</el-button-group>

<el-button-group>
<el-button icon="refresh"
v-on:click="refresh"
:disabled="loading || !selectedMailbox"
title="Refresh"></el-button>

Check warning on line 39 in Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <el-button> tag.

See more on https://sonarcloud.io/project/issues?id=rnwood_smtp4dev&issues=AZ1hzA3KV80h1QdmN00f&open=AZ1hzA3KV80h1QdmN00f&pullRequest=2104
<el-button v-on:click="markAllMessageRead"
:disabled="loading || !selectedMailbox"
title="Mark all as read">

Check warning on line 42 in Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <el-button> tag.

See more on https://sonarcloud.io/project/issues?id=rnwood_smtp4dev&issues=AZ1hzA3KV80h1QdmN00g&open=AZ1hzA3KV80h1QdmN00g&pullRequest=2104
<font-awesome-icon :icon="['fa-regular','envelope-open']" />
</el-button>
<el-button icon="close" title="Clear" @click="clear"></el-button>
Expand Down Expand Up @@ -83,7 +83,7 @@

<el-alert v-if="error" type="error" title="Error" show-icon>
{{ error.message }}
<el-button v-on:click="refresh">Retry</el-button>

Check warning on line 86 in Rnwood.Smtp4dev/ClientApp/src/components/messagelist.vue

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a 'onKeyPress|onKeyDown|onKeyUp' attribute to this <el-button> tag.

See more on https://sonarcloud.io/project/issues?id=rnwood_smtp4dev&issues=AZ1hzA3KV80h1QdmN00h&open=AZ1hzA3KV80h1QdmN00h&pullRequest=2104
</el-alert>

<el-table :data="messages"
Expand Down Expand Up @@ -396,7 +396,7 @@
const emlContent = await this.readFileAsText(file);

// Call the import API for this single file
const messageId = await new MessagesController().import(emlContent, this.selectedMailbox);
const messageId = await new MessagesController().import(emlContent, this.selectedMailbox, this.selectedFolder);

successCount++;
importedIds.push(messageId);
Expand Down
5 changes: 3 additions & 2 deletions Rnwood.Smtp4dev/Controllers/MessagesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -529,12 +529,13 @@ public async Task Delete(Guid id)
/// Imports a single EML file as a new message.
/// </summary>
/// <param name="mailboxName">Mailbox name to import the message into</param>
/// <param name="folderName">Folder name to import the message into (e.g. INBOX, Sent). Defaults to INBOX.</param>
/// <returns>The ID of the imported message</returns>
[HttpPut]
[Consumes("message/rfc822")]
[SwaggerResponse(System.Net.HttpStatusCode.OK, typeof(Guid), Description = "ID of the imported message")]
[SwaggerResponse(System.Net.HttpStatusCode.BadRequest, typeof(void), Description = "If the EML content is invalid")]
public async Task<ActionResult<Guid>> ImportMessage(string mailboxName = MailboxOptions.DEFAULTNAME)
public async Task<ActionResult<Guid>> ImportMessage(string mailboxName = MailboxOptions.DEFAULTNAME, string folderName = MailboxFolder.INBOX)
{
try
{
Expand Down Expand Up @@ -601,7 +602,7 @@ public async Task<ActionResult<Guid>> ImportMessage(string mailboxName = Mailbox
}

dbMessage.Mailbox = mailbox;
dbMessage.MailboxFolder = await dbContext.MailboxFolders.FirstOrDefaultAsync(f => f.Mailbox.Name == mailboxName && f.Name == MailboxFolder.INBOX);
dbMessage.MailboxFolder = await dbContext.MailboxFolders.FirstOrDefaultAsync(f => f.Mailbox.Name == mailboxName && f.Name == folderName);
dbMessage.IsUnread = true;

// Add to database
Expand Down