i am trying to send a msg as discribed in the documentation using the Chat.send(Message) method in and it does not work. The other user does not receive the message(s) i send.
In the same method i cam sucesfully use Chat.send(String) to to send my content.
But i would like to senda mesage with a subject and receipient address to a user and not start a chat.
snippet of the code i use follows.
start of code------
public void send (String user,String subject,XHTMLText xhtmlText)throws XMPPException {
if (subject==null){
subject=“no subject”;
}
//Chat newChat = conn.createChat(“vkanta@xxx.xxx.x”);
Chat newChat = conn.createChat(user);
//newChat.sendMessage("my name is super luser ");
//convert the content to sttring so that we can send it.
String content =xhtmlText.toString();
System.out.println (content);
System.out.println("sending mesg to "+user);
Message msg = newChat.createMessage();
msg.setTo(user);
msg.setFrom(“notifier”);
msg.setSubject(subject);
msg.setBody(content);
msg.setProperty(“favoriteColor”, “red”);
//org.jivesoftware.smackx.XHTMLManager.addBody(msg,content );
newChat.sendMessage(msg.toString());
//newChat.sendMessage(msg);
end of code —
i would like to use the above commneted line if possible
any suggestions please?