mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
1 parent
c63e10a135
commit
686c9fb08b
2 files changed
+86
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { Mail } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Mailto Generator',
|
||||
path: '/mailto-generator',
|
||||
description: 'Generate a mailto: link href',
|
||||
keywords: ['mailto', 'generator', 'link'],
|
||||
component: () => import('./mailto-generator.vue'),
|
||||
icon: Mail,
|
||||
createdAt: new Date('2025-08-17'),
|
||||
category: 'Development',
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue';
|
||||
import { NButton, NCard, NForm, NFormItem, NInput } from 'naive-ui';
|
||||
|
||||
const form = ref({
|
||||
to: '',
|
||||
cc: '',
|
||||
bcc: '',
|
||||
subject: '',
|
||||
body: '',
|
||||
});
|
||||
|
||||
const mailtoLink = computed(() => {
|
||||
const to = form.value.to;
|
||||
if (!to) {
|
||||
return '';
|
||||
}
|
||||
const params = new URLSearchParams();
|
||||
if (form.value.subject) {
|
||||
params.append('subject', form.value.subject);
|
||||
}
|
||||
if (form.value.body) {
|
||||
params.append('body', form.value.body);
|
||||
}
|
||||
if (form.value.cc) {
|
||||
params.append('cc', form.value.cc);
|
||||
}
|
||||
if (form.value.bcc) {
|
||||
params.append('bcc', form.value.bcc);
|
||||
}
|
||||
|
||||
return `mailto:${to}?${params.toString()}`;
|
||||
});
|
||||
|
||||
function openMailto() {
|
||||
window.location.href = mailtoLink.value;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NCard title="Mailto Link Generator">
|
||||
<NForm :model="form" label-placement="left">
|
||||
<NFormItem label="To:">
|
||||
<NInput v-model:value="form.to" placeholder="recipient@example.com" />
|
||||
</NFormItem>
|
||||
<NFormItem label="CC:">
|
||||
<NInput v-model:value="form.cc" placeholder="cc@example.com" />
|
||||
</NFormItem>
|
||||
<NFormItem label="BCC:">
|
||||
<NInput v-model:value="form.bcc" placeholder="bcc@example.com" />
|
||||
</NFormItem>
|
||||
<NFormItem label="Subject:">
|
||||
<NInput v-model:value="form.subject" placeholder="Email subject" />
|
||||
</NFormItem>
|
||||
<NFormItem label="Body:" label-placement="top">
|
||||
<NInput
|
||||
v-model:value="form.body"
|
||||
type="textarea"
|
||||
placeholder="Email body"
|
||||
:autosize="{ minRows: 3, maxRows: 6 }"
|
||||
/>
|
||||
</NFormItem>
|
||||
<c-card v-if="mailtoLink" title="Generated Link">
|
||||
<textarea-copyable :value="mailtoLink" />
|
||||
<n-space justify="center">
|
||||
<NButton type="primary" @click="openMailto">
|
||||
Open Mail Client
|
||||
</NButton>
|
||||
</n-space>
|
||||
</c-card>
|
||||
</NForm>
|
||||
</NCard>
|
||||
</template>
|
||||
Reference in new issue
Block a user