Data Manipulation?

M

Merrigan

Hi There,

I Posted a while ago about a challenge I had in splitting an E-Mail
adress up to use it. Anyways, the same script but different issue.
Some Background:

The script is going to be used to manage a Virtual User Based E-Mail
system. Now the part I'm struggling with is to delete the E-Mail
address from the database, and then giving the user the option to
DELETE and/or modify any E-Mail Aliases associated to the Deleted E-
Mail Address.

The delete code up to this stage only gives me a list of associated
Aliases:

def delUser():
conn_db()
use = "USE %s" % mysql_db
db_cursor.execute(use)
print "DATABASE ONLINE"
e_mail = raw_input("Please Provide a the E-Mail Address you wish to
Delete: ")
del_statement = "DELETE FROM users WHERE email = '%s';" % e_mail
db_cursor.execute(del_statement)
un_dom = e_mail.split("@")
username = un_dom[0]
domain = un_dom[1]
domdir = maildir + '%s' % domain
os.rmdir(domdir + '/' + username + '/' + 'cur')
os.rmdir(domdir + '/' + username + '/' + 'new')
os.rmdir(domdir + '/' + username + '/' + 'tmp')
os.rmdir(domdir + '/' + username)
print "User Removed from Database. Now Proceding To associated E-Mail
Aliases"
select_statement = "SELECT source, destination FROM mail.forwardings
WHERE destination = '%s'" % e_mail
result = db_cursor.execute(select_statement)
if result >= 1:
aliasLine = 0
number = result - 1
while aliasLine <= number:
db_cursor.execute(select_statement)
answer = db_cursor.fetchall()
answer_1 = answer[aliasLine]
aliasLine = aliasLine + 1
print '%s is still linked to %s, do you wish to remove the E-Mail
Alias?' % (answer_1[0], answer_1[1])

How can I now get this to give me the options to delete an adress, or
everything, or delete one and modify the rest...or all that you
know...

Thank ye once again, This group rocks!

-- Merrigan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,297
Latest member
EngineerD

Latest Threads

Top