my $message_was_sent = send_message();
# set up for the next message
- if ($message_was_sent &&
+ if ($thread && $message_was_sent &&
($chain_reply_to || !defined $reply_to || length($reply_to) == 0)) {
$reply_to = $message_id;
if (length $references > 0) {