Files
juwan-backend/desc/rpc/email.proto

93 lines
2.4 KiB
Protocol Buffer

syntax = "proto3";
package email;
option go_package = "./email";
service EmailService {
// 发送验证码邮件
rpc SendVerificationCode(SendVerificationCodeReq) returns (SendVerificationCodeResp);
// 发送通用邮件
rpc SendEmail(SendEmailReq) returns (SendEmailResp);
// 批量发送邮件
rpc SendBatchEmail(SendBatchEmailReq) returns (SendBatchEmailResp);
// 发送模板邮件
rpc SendTemplateEmail(SendTemplateEmailReq) returns (SendTemplateEmailResp);
}
// 发送验证码请求
message SendVerificationCodeReq {
string to = 1; // 收件人邮箱
string code = 2; // 验证码
string type = 3; // 类型: register, reset, login
string language = 4; // 语言: zh-CN, en-US
int32 expire_minutes = 5; // 过期时间(分钟)
}
// 发送验证码响应
message SendVerificationCodeResp {
int32 code = 1;
string message = 2;
string message_id = 3; // 邮件ID,用于追踪
}
// 发送通用邮件请求
message SendEmailReq {
string to = 1; // 收件人
string subject = 2; // 主题
string body = 3; // 邮件内容(HTML)
string cc = 4; // 抄送
string bcc = 5; // 密送
repeated Attachment attachments = 6; // 附件
EmailPriority priority = 7; // 优先级
}
// 发送通用邮件响应
message SendEmailResp {
int32 code = 1;
string message = 2;
string message_id = 3;
}
// 批量发送邮件请求
message SendBatchEmailReq {
repeated string to_list = 1; // 收件人列表
string subject = 2;
string body = 3;
EmailPriority priority = 4;
}
// 批量发送邮件响应
message SendBatchEmailResp {
int32 code = 1;
string message = 2;
int32 success_count = 3;
int32 failed_count = 4;
repeated FailedEmail failed_list = 5;
}
// 发送模板邮件请求
message SendTemplateEmailReq {
string to = 1;
string template_name = 2; // 模板名称
map<string, string> params = 3; // 模板参数
string language = 4;
}
// 发送模板邮件响应
message SendTemplateEmailResp {
int32 code = 1;
string message = 2;
string message_id = 3;
}
// 附件
message Attachment {
string filename = 1;
bytes content = 2;
string content_type = 3; // MIME类型
}
// 邮件优先级
enum EmailPriority {
NORMAL = 0;
HIGH = 1;
LOW = 2;
}
// 失败的邮件
message FailedEmail {
string email = 1;
string reason = 2;
}