当前位置: 首页 > 工具软件 > Chilkat > 使用案例 >

python included,Python使用Chilkat -- Password included

司空镜
2023-12-01

importurllib2

importurllib

importsys

importre

importmath

importos

importtime

importstring

importdatetime

importio

importlxml

importxmlrpclib

importPIL

importmimetypes

importsocket

importshutil

importConfigParser

importglob

importlogging, logging.handlers

importbinascii

importchilkat

importcgi

fromBeautifulSoupimportBeautifulSoup,NavigableString

fromurllib2importRequest, urlopen, URLError, HTTPError

fromtypesimport*

forpinsys.argv:

if(p.find("-host=") != -1):

host = p.split("=")[1]

if(p.find("-ssl=") != -1):

ssl = p.split("=")[1]

if(p.find("-port=") != -1):

port = p.split("=")[1]

if(p.find("-username=") != -1):

username = p.split("=")[1]

displayname = username.split('@')[0]

if(p.find("-password=") != -1):

password = p.split("=")[1]

http = chilkat.CkHttp()

success = http.UnlockComponent("SVERTLEADHttp_qcaVzzoP4J6Y")

if(success != True):

sys.exit()

defmain():

post_email = username

mailman = chilkat.CkMailMan()

#  Any string argument automatically begins the 30-day trial. CHRISSMAILQ_hSXBOYyQnU1Y | MAILT34MB34N_50D59A750UEU

success = mailman.UnlockComponent("CHRISSMAILQ_hSXBOYyQnU1Y")

if(success != True):

print"Component unlock failed"

sys.exit()

#  Set the SMTP server.

mailman.put_SmtpHost(host)

# Set SSL properties:

mailman.put_SmtpPort(int(port))

mailman.put_SmtpSsl(ssl)

#  Set the SMTP login/password (if required)

##mailman.put_SmtpUsername("dwilliamsweb@gmail.com")

mailman.put_SmtpUsername(username)

mailman.put_SmtpPassword(password)

post_title = 'test new smtp account'

#  Create a new email object

email = chilkat.CkEmail()

email.put_Subject("Re: "+ post_title)

email.AddTo(post_email,post_email)

email.put_From(displayname +"")

email_content ="Hi,\ntesting new smtp account"

email.put_Body(email_content)

success = mailman.SendEmail(email)

ifsuccess == True:

print'success'

else:

print'error'

mailman.CloseSmtpConnection()

###

if__name__ =="__main__":

main()

 类似资料: