Untitled

 avatar
unknown
plain_text
6 months ago
2.4 kB
3
Indexable
import time
from datetime import timedelta
from verify_email import verify_email

# Function to process emails in chunks
def process_emails_in_batches(email_batches):
    total_emails_verified = 0
    total_time_taken = 0.0

    while True:  # Infinite loop
        for email in email_batches:
            start_time = time.time()

            # Validate email using the verify_email library
            is_valid = verify_email(email)
            
            # Set status based on validation result
            status = "Available" if is_valid else "Not Available"
            status_code = 250 if is_valid else 550
            if status == "Available":
                total_emails_verified += 1

            # Calculate time taken to validate the email
            time_taken = time.time() - start_time
            total_time_taken += time_taken

            # Format the total time into a readable format
            formatted_total_time = str(timedelta(seconds=int(total_time_taken)))

            # Print the result in the requested format
            print(f"{email} - {status} - Status Code: {status_code}")
            print(f"Time taken to validate {email}: {time.strftime('%H:%M:%S', time.gmtime(time_taken))} "
                    f"| Total emails verified: {total_emails_verified} "
                    f"| Total time so far: {formatted_total_time}")

# Mock email batches (replace this with actual 50-50 chunks as per your need)
email_batches = [
    "abarakadabara69@gmail.com", 
    "abarakadabara698@gmail.com", 
    "abarakadabaraaaa69@gmail.com",
    "invalid.email@xyz.com",       
    "missing_at_symbol.com",       
    "another.fake@domain",         
    "user.name@gmail..com",        
    "user.name@gmail,com",         
    "user name@gmail.com", 
    "jayamshrivastav1@gmail.com",  
    "username@gmail.c",            
    "username@gmail",              
    "username@.com",
    "jayamshrivastav04@gmail.com", 
    "@gmail.com",                  
    "username@domain@gmail.com",   
    "user@ gmail.com",             
    "user@domain..com",  
    "user@domain..co.uk"  ,
    
    "jayamshrivastav2@gmail.com", 
    
    # Add more emails in batches of 50 or as required
]

# Start the infinite loop to process emails in batches
process_emails_in_batches(email_batches)
Editor is loading...
Leave a Comment