In doubles table tennis does the rules allow you to serve to the side of the table (red line) or only to the end of the table (green line)?
Player B is serving.
Rule 2.6.3 of the official rules states:
in doubles, the ball shall touch successively the right half court of server and receiver.
There is no requirement that the ball crosses the end line of the receiving team - but note that the serve you've drawn would result in the server losing the point as it is not touching the right half court of the server and the receiver.
In doubles, you must always serve from the right half of the server's side with the ball going diagonally to the right half of the opposite side.
The image in the question is an incorrect serve as you never serve from the left half (Player B in image question), but instead Player B also serves from the right half to the opposite right half but with Player 2 as the receiver (like the yellow arrow).