471,336 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,336 software developers and data experts.

Data Manipulation?

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
Dec 14 '07 #1
0 744

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ferran Foz | last post: by
2 posts views Thread by ajay | last post: by
3 posts views Thread by Ben R. | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.