Commit 32adfef5 authored by Peter Cheng's avatar Peter Cheng

追加寄件副本功能

parent 63fc6881
......@@ -15,8 +15,9 @@ var _ = math.Inf
type SendMail struct {
To string ` protobuf:"bytes,1,opt,name=To" json:"To,omitempty" form:"to"`
Subject string ` protobuf:"bytes,2,opt,name=Subject" json:"Subject,omitempty" form:"subject"`
Content string ` protobuf:"bytes,3,opt,name=Content" json:"Content,omitempty" form:"content"`
Cc string ` protobuf:"bytes,2,opt,name=Cc" json:"Cc,omitempty" form:"cc"`
Subject string ` protobuf:"bytes,3,opt,name=Subject" json:"Subject,omitempty" form:"subject"`
Content string ` protobuf:"bytes,4,opt,name=Content" json:"Content,omitempty" form:"content"`
}
func (m *SendMail) Reset() { *m = SendMail{} }
......@@ -31,6 +32,13 @@ func (m *SendMail) GetTo() string {
return ""
}
func (m *SendMail) GetCc() string {
if m != nil {
return m.Cc
}
return ""
}
func (m *SendMail) GetSubject() string {
if m != nil {
return m.Subject
......@@ -52,12 +60,13 @@ func init() {
func init() { proto.RegisterFile("sendMail.proto", fileDescriptor1) }
var fileDescriptor1 = []byte{
// 106 bytes of a gzipped FileDescriptorProto
// 116 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x4e, 0xcd, 0x4b,
0xf1, 0x4d, 0xcc, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x4d, 0x4a, 0x4d, 0xcc,
0x2b, 0x56, 0xf2, 0xe3, 0xe2, 0x08, 0x86, 0x4a, 0x08, 0xf1, 0x71, 0x31, 0x85, 0xe4, 0x4b, 0x30,
0x2a, 0x30, 0x6a, 0x70, 0x06, 0x31, 0x85, 0xe4, 0x0b, 0x49, 0x70, 0xb1, 0x07, 0x97, 0x26, 0x65,
0xa5, 0x26, 0x97, 0x48, 0x30, 0x81, 0x05, 0x61, 0x5c, 0x90, 0x8c, 0x73, 0x7e, 0x5e, 0x49, 0x6a,
0x5e, 0x89, 0x04, 0x33, 0x44, 0x06, 0xca, 0x4d, 0x62, 0x03, 0x9b, 0x6e, 0x0c, 0x08, 0x00, 0x00,
0xff, 0xff, 0x98, 0x81, 0xc8, 0x1d, 0x6f, 0x00, 0x00, 0x00,
0x2b, 0x56, 0x8a, 0xe3, 0xe2, 0x08, 0x86, 0x4a, 0x08, 0xf1, 0x71, 0x31, 0x85, 0xe4, 0x4b, 0x30,
0x2a, 0x30, 0x6a, 0x70, 0x06, 0x31, 0x85, 0xe4, 0x83, 0xf8, 0xce, 0xc9, 0x12, 0x4c, 0x10, 0xbe,
0x73, 0xb2, 0x90, 0x04, 0x17, 0x7b, 0x70, 0x69, 0x52, 0x56, 0x6a, 0x72, 0x89, 0x04, 0x33, 0x58,
0x10, 0xc6, 0x05, 0xc9, 0x38, 0xe7, 0xe7, 0x95, 0xa4, 0xe6, 0x95, 0x48, 0xb0, 0x40, 0x64, 0xa0,
0xdc, 0x24, 0x36, 0xb0, 0x6d, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfa, 0x28, 0xd8, 0x50,
0x7f, 0x00, 0x00, 0x00,
}
......@@ -4,6 +4,7 @@ package beans;
message SendMail {
string To = 1; //`form:"to"`
string Subject = 2; //`form:"subject"`
string Content = 3; //`form:"content"`
string Cc = 2; //`form:"cc"`
string Subject = 3; //`form:"subject"`
string Content = 4; //`form:"content"`
}
\ No newline at end of file
......@@ -28,6 +28,9 @@ func doSendMail(params *beans.SendMail) {
mail := gomail.NewMessage()
mail.SetHeader("From", cfg.Mail.From)
mail.SetHeader("To", params.GetTo())
if "" != params.GetCc() {
mail.SetHeader("Cc", params.GetCc())
}
mail.SetHeader("Subject", params.GetSubject())
mail.SetBody("text/html", params.GetContent())
send := gomail.NewPlainDialer(cfg.Mail.Host, cfg.Mail.Port, cfg.Mail.User, cfg.Mail.Password)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment