{"record":{"id":"800a361f47f05ab8","repo":"jstedfast/MailKit","slug":"no-recipients-have-been-specified","errorCode":null,"errorMessage":"No recipients have been specified.","messagePattern":"No recipients have been specified\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"MailKit/Net/Smtp/SmtpClient.cs","lineNumber":2526,"sourceCode":"\n\t\tstatic void ValidateArguments (FormatOptions options, MimeMessage message, out MailboxAddress sender, out IList<MailboxAddress> recipients)\n\t\t{\n\t\t\tif (options == null)\n\t\t\t\tthrow new ArgumentNullException (nameof (options));\n\n\t\t\tif (message == null)\n\t\t\t\tthrow new ArgumentNullException (nameof (message));\n\n\t\t\tvar mailbox = GetMessageSender (message);\n\n\t\t\tif (mailbox == null)\n\t\t\t\tthrow new InvalidOperationException (\"No sender has been specified.\");\n\n\t\t\tsender = mailbox;\n\t\t\trecipients = GetMessageRecipients (message);\n\n\t\t\tif (recipients.Count == 0)\n\t\t\t\tthrow new InvalidOperationException (\"No recipients have been specified.\");\n\t\t}\n\n\t\t/// <summary>\n\t\t/// Send the specified message.\n\t\t/// </summary>\n\t\t/// <remarks>\n\t\t/// <para>Sends the specified message.</para>\n\t\t/// <para>The sender address is determined by checking the following\n\t\t/// message headers (in order of precedence): Resent-Sender,\n\t\t/// Resent-From, Sender, and From.</para>\n\t\t/// <para>If either the Resent-Sender or Resent-From addresses are present,\n\t\t/// the recipients are collected from the Resent-To, Resent-Cc, and\n\t\t/// Resent-Bcc headers, otherwise the To, Cc, and Bcc headers are used.</para>\n\t\t/// </remarks>\n\t\t/// <example>\n\t\t/// <code language=\"c#\" source=\"Examples\\SmtpExamples.cs\" region=\"SendMessageWithOptions\"/>\n\t\t/// </example>\n\t\t/// <returns>The final free-form text response from the server.</returns>","sourceCodeStart":2508,"sourceCodeEnd":2544,"githubUrl":"https://github.com/jstedfast/MailKit/blob/9d3859a7855e3e17582c07fd01972b8e262bf176/MailKit/Net/Smtp/SmtpClient.cs#L2508-L2544","documentation":"Validation in SmtpClient.ValidateArguments: GetMessageRecipients found no To, Cc, Bcc (or Resent-* equivalents) addresses on the message, so there is no one to send it to (RCPT TO would have no recipients) and InvalidOperationException is thrown.","triggerScenarios":"MimeMessage without To/Cc/Bcc.","commonSituations":"Empty recipient input from user data.","solutions":["Add recipients before send.","Use explicit recipients overload."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"if (!(message.To.Any() || message.Cc.Any() || message.Bcc.Any()))\n\tthrow new InvalidOperationException(\"missing recipients\");","typeGuard":"bool HasRecipients(MimeMessage m) => m.To?.Any() == true || m.Cc?.Any() == true || m.Bcc?.Any() == true;","tryCatchPattern":"catch (InvalidOperationException ex) when (ex.Message == \"No recipients have been specified.\") { /* dead-letter */ }","preventionTips":["Validate recipients at input boundary."],"tags":["smtp","mailkit","missing-recipients"],"backgroundTag":"empty-required-field","analyzedSha":"9d3859a7855e3e17582c07fd01972b8e262bf176","analyzedAt":"2026-09-15T15:46:11.592Z","contentChangedAt":"2026-09-15T15:46:11.592Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}