### What problem does this PR solve? _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ Added the function of sending emails through SMTP Instructions for use- Corresponding parameters need to be configured Need to output upstream in a fixed format  ### Type of change - [√] New Feature (non-breaking change which adds functionality) --------- Co-authored-by: Kevin Hu <kevinhu.sh@gmail.com>
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { useTranslate } from '@/hooks/common-hooks';
|
|
import { Form, Input } from 'antd';
|
|
import { IOperatorForm } from '../../interface';
|
|
import DynamicInputVariable from '../components/dynamic-input-variable';
|
|
|
|
const EmailForm = ({ onValuesChange, form, node }: IOperatorForm) => {
|
|
const { t } = useTranslate('flow');
|
|
|
|
return (
|
|
<Form
|
|
name="basic"
|
|
autoComplete="off"
|
|
form={form}
|
|
onValuesChange={onValuesChange}
|
|
layout={'vertical'}
|
|
>
|
|
<DynamicInputVariable nodeId={node?.id}></DynamicInputVariable>
|
|
|
|
{/* SMTP服务器配置 */}
|
|
<Form.Item label={t('smtpServer')} name={'smtp_server'}>
|
|
<Input placeholder="smtp.example.com" />
|
|
</Form.Item>
|
|
<Form.Item label={t('smtpPort')} name={'smtp_port'}>
|
|
<Input type="number" placeholder="587" />
|
|
</Form.Item>
|
|
<Form.Item label={t('senderEmail')} name={'email'}>
|
|
<Input placeholder="sender@example.com" />
|
|
</Form.Item>
|
|
<Form.Item label={t('authCode')} name={'password'}>
|
|
<Input.Password placeholder="your_password" />
|
|
</Form.Item>
|
|
<Form.Item label={t('senderName')} name={'sender_name'}>
|
|
<Input placeholder="Sender Name" />
|
|
</Form.Item>
|
|
|
|
{/* 动态参数说明 */}
|
|
<div style={{ marginBottom: 24 }}>
|
|
<h4>{t('dynamicParameters')}</h4>
|
|
<div>{t('jsonFormatTip')}</div>
|
|
<pre style={{ background: '#f5f5f5', padding: 12, borderRadius: 4 }}>
|
|
{`{
|
|
"to_email": "recipient@example.com",
|
|
"cc_email": "cc@example.com",
|
|
"subject": "Email Subject",
|
|
"content": "Email Content"
|
|
}`}
|
|
</pre>
|
|
</div>
|
|
</Form>
|
|
);
|
|
};
|
|
|
|
export default EmailForm;
|