[Python] implements the XMPP protocol IM send Message function

Source: Internet
Author: User

#-*-coding:utf-8-*-__author__='TSBC'ImportXMPPImport Time#Note the account information, must add the @ domain name formatFrom_user ='[email protected]'Password='A1b2c3d4'#you can add more than one recipientTo_user = ['[email protected]']msg="Hello! This is a test message! "defto_msg ():"""Instant Messaging messaging based on XMPP protocol, need to install XMPP library use OpenFire to build instant messaging that can be used with Google Talk"""Client= XMPP. Client ('xtpt.e-u.cn') client.connect (server= ('xtpt.e-u.cn', 5223)) Client.auth (from_user, password,'Botty') forIinchto_user:client.sendInitPresence () message= XMPP. Message (i, msg, Typ ='Chat') client.send (message) Time.sleep (0.2)if __name__=='__main__': to_msg ()

[Python] implements the XMPP protocol IM send Message function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.