This letter is written to Gaius, a fellow believer and apparently a church leader in Asia. There are a few men named Gaius who are mentioned in Acts and two other epistles, although there is no clear evidence to link any of them to the recipient of John's letter. Still, Gaius is called beloved more than once in John's letter. It was likely that he was a close disciple of John, given John's reference to joy over seeing his children walk in truth.
The main theme of this letter appears to be the proper relationships among fellow Christians. Whereas 2 John stresses the importance of denying hospitality to false teachers, 3 John encourages hospitality in general. First, John made a point to encourage Gaius, letting him know that he was aware of his actions toward fellow believers and strangers. Gaius was known for his outward display of hospitality.
Itinerant preachers were not uncommon among the first century church. They traveled throughout the churches in Asia much like Paul and his associates did to teach the Word of God and strengthen the faith of believers. These sojourners were often taken in and accommodated by hospitable Christians throughout the cities they traveled through. Gaius was one who recognized and honored the sacred calling of those who were messengers of God's Word.
But John used another example, juxtaposed to reveal the thoughts and intentions of two different men. The other example was Diotrephes, an individual in the church who desired a position of high status and importance rather than a godly reputation. John's letter is not clear as to what leadership position this man held in the church if any. But it is clear that Diotrephes did not bear the same witness as Gaius. Diotrephes spoke evil of John and other church leadership, not recognizing their apostolic headship. What's worse, he lorded over the other believers, not only refusing hospitality to itinerant preachers but ordering others to do the same and excommunicating those who didn't.
John's final charge to Gaius was to not imitate such evil actions of those who clearly did not belong to God. Unity among the believers was of utmost importance, and any uncharitable actions disrupted the harmony of the church. It was Gaius' responsibility as a church leader to continue to set the example in love, faithfulness and holiness.