Skip to content

Commit

Permalink
EmailBee: let user specify email's sender. Fixes #154
Browse files Browse the repository at this point in the history
  • Loading branch information
muesli committed Jul 4, 2017
1 parent bbef3e9 commit 91ef39d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bees/emailbee/emailbee.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,19 @@ func (mod *EmailBee) Action(action bees.Action) []bees.Placeholder {

switch action.Name {
case "send":
var to, plainText, htmlText, subject string
var from, to, plainText, htmlText, subject string
action.Options.Bind("sender", &from)
action.Options.Bind("recipient", &to)
action.Options.Bind("subject", &subject)
action.Options.Bind("text", &plainText)
action.Options.Bind("html", &htmlText)

m := gomail.NewMessage()
m.SetHeader("From", mod.username)
if len(from) > 0 {
m.SetHeader("From", from)
} else {
m.SetHeader("From", mod.username)
}
m.SetHeader("To", to)
m.SetHeader("Subject", subject)
if plainText != "" {
Expand Down
5 changes: 5 additions & 0 deletions bees/emailbee/emailbeefactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ func (factory *EmailBeeFactory) Actions() []bees.ActionDescriptor {
Name: "send",
Description: "Sends an email",
Options: []bees.PlaceholderDescriptor{
{
Name: "sender",
Description: "email address of the sender",
Type: "string",
},
{
Name: "recipient",
Description: "email address of the recipient",
Expand Down

0 comments on commit 91ef39d

Please sign in to comment.