Python使用Chilkat -- Password included

import urllib2css

import urllibweb

import syssocket

import repost

import mathui

import osurl

import timespa

import stringorm

import datetimeserver

import ioxml

import lxml

import xmlrpclib

import PIL

import mimetypes

import socket

import shutil

import ConfigParser

import glob

import logging, logging.handlers

import binascii

import chilkat

import cgi


from BeautifulSoup import BeautifulSoup,NavigableString

from urllib2 import Request, urlopen, URLError, HTTPError

from types import *




for p in sys.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()




def main():

   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 + "<"+username+">")

   

   email_content = "Hi,\ntesting new smtp account"

   email.put_Body(email_content)

   

   success = mailman.SendEmail(email)

   if success == True:

   print 'success'

   else:

   print 'error'

   mailman.CloseSmtpConnection()

### 

if __name__ == "__main__":

   main()

相關文章
相關標籤/搜索