Пример #1
0
func callMailboxAction(action *string) {
	mailbox := mailboxmod.NewMailbox(*mailboxMailArgs)

	switch *action {
	case "list":
		mailbox.Fetch(*mailboxLimitArgs)
		if mailbox.Count() != 0 {
			mailboxmod.Render(mailbox)
		} else {
			mailboxmod.RenderMessage("Mo mails found")
		}
	case "flush":
		mailbox.Flush()
		mailboxmod.RenderMessage("Mailbox flushed")
	}
}
Пример #2
0
func callMailAction(action *string) {
	mailbox := mailboxmod.NewMailbox(*mailMailArgs)
	mailbox.Fetch(*mailPositionArgs)
	mail := mailbox.Get(*mailPositionArgs - 1)

	if mail != nil {
		switch *action {
		case "read":
			mail.Fetch()
			mailmod.Render(mail)
		case "delete":
			mail.Delete()
			mailmod.RenderMessage("Mail deleted")
		}
	} else {
		mailmod.RenderMessage("No mail found")
	}
}