(t *testing.T)
| 166 | } |
| 167 | |
| 168 | func TestComposeMessageCCOnlyOmitsToHeader(t *testing.T) { |
| 169 | raw, err := ComposeMessage( |
| 170 | "from@test.com", |
| 171 | nil, |
| 172 | []string{"carol@gmail.com"}, |
| 173 | "Hello", |
| 174 | "Body", |
| 175 | "text/plain", |
| 176 | "", |
| 177 | nil, |
| 178 | "test.dev", |
| 179 | "", |
| 180 | "", |
| 181 | ) |
| 182 | if err != nil { |
| 183 | t.Fatalf("ComposeMessage failed: %v", err) |
| 184 | } |
| 185 | |
| 186 | msg, _ := mail.ReadMessage(strings.NewReader(string(raw))) |
| 187 | if got := msg.Header.Get("To"); got != "" { |
| 188 | t.Errorf("To = %q, want empty (CC-only)", got) |
| 189 | } |
| 190 | if got := msg.Header.Get("Cc"); got != "carol@gmail.com" { |
| 191 | t.Errorf("Cc = %q, want carol@gmail.com", got) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | func TestComposeMessageNoBccHeader(t *testing.T) { |
| 196 | // BCC should never appear in composed message headers |
nothing calls this directly
no test coverage detected