Question

cl = xmpp.Client('myserver.com')
if not cl.connect(server=('mysefver.com',5223)):
    raise IOError('cannot connect to server')
cl.RegisterHandler('message',messageHandler)
cl.auth('myemail@myserver.com', 'mypassword', 'statusbot')
cl.sendInitPresence()

msgtext = formatToDo(cal, 'text')
message = xmpp.Message('anotheremail@myserver.com',  msgtext) 
message.setAttr('type', 'chat')
cl.send(message)

I get the following error message when I try to run it:

xmpp.protocol.InvalidFrom: (u'invalid-from', '')

Why is this happening :(

Was it helpful?

Solution

From the XMPP protocol specification:

If the value of the 'from' address does not match the hostname represented by the Receiving Server when opening the TCP connection (or any validated domain thereof, such as a validated subdomain of the Receiving Server's hostname or another validated domain hosted by the Receiving Server), then the Authoritative Server MUST generate an stream error condition and terminate both the XML stream and the underlying TCP connection.

which basically means, that if the sender is not recognized by the xmpp-server, it'll reply with this message. XMPP supplies a registration mechanism: xmpp.features.register

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top