LastMessage returns a shallow copy of the last sent message. Returns an empty mailer.Message struct if there are no sent messages.
()
| 68 | // |
| 69 | // Returns an empty mailer.Message struct if there are no sent messages. |
| 70 | func (tm *TestMailer) LastMessage() mailer.Message { |
| 71 | tm.mux.Lock() |
| 72 | defer tm.mux.Unlock() |
| 73 | |
| 74 | var m mailer.Message |
| 75 | |
| 76 | if len(tm.messages) > 0 { |
| 77 | return *tm.messages[len(tm.messages)-1] |
| 78 | } |
| 79 | |
| 80 | return m |
| 81 | } |
no outgoing calls