require 'xmpp4r/client' include Jabber # Login jid = JID::new('me@jabber.org/Work') password = '--some_secret--' cl = Client::new(jid) cl.connect cl.auth(password) # Create a message to = "you@xmpp.org" subject = "XMPP4R Rich-Text Test" body = "Wow, I can do HTML now. But if you see this, your client doesn't support it" m = Message::new(to, body).set_type(:normal).set_id('1').set_subject(subject) # Create the html part h = REXML::Element::new("html") h.add_namespace('http://jabber.org/protocol/xhtml-im') # The body part with the correct namespace b = REXML::Element::new("body") b.add_namespace('http://www.w3.org/1999/xhtml') # The html itself t = REXML::Text.new( "This is so COOL!!!. I can really do HTML now.", false, nil, true, nil, %r/.^/ ) # Add the html text to the body, and the body to the html element b.add(t) h.add(b) # Add the html element to the message m.add_element(h) # Send it cl.send m