Untitled

 avatar
unknown
plain_text
a year ago
3.4 kB
5
Indexable
import requests
import sys
import re
import colorama
import time

colorama.init()

def read_file_lines(file_path):
    with open(file_path, 'r') as file:
        lines = file.read().splitlines()
    return lines
def send_test_email(email,html_content):

    headers = {
    'authority': 'api.referralcandy.com',
    'accept': 'application/json',
    'accept-language': 'en-US,en;q=0.9',
    'authorization': 'Bearer eyJraWQiOiJcL0NcL3pOZDRST1N6aGlzQXhTRkQwZ3FLU25oV3hJeVlHakJyeEdRSnVFcUU9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI4NTNiNjY4OS0wODg4LTRlNTItODMzNi1lNjY4ZWNhMjdkNzciLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLmFwLXNvdXRoZWFzdC0xLmFtYXpvbmF3cy5jb21cL2FwLXNvdXRoZWFzdC0xX2JxQ3Q5dVh2MCIsImNvZ25pdG86dXNlcm5hbWUiOiI4NTNiNjY4OS0wODg4LTRlNTItODMzNi1lNjY4ZWNhMjdkNzciLCJvcmlnaW5fanRpIjoiMmYwOTdhNWItMjU0My00NzNmLWE1MWMtODI2YjQ1YTgwZjk3IiwiYXVkIjoiNGNwc3NybjU0cDQ3M284MzdpNmt0ZnNkMyIsImV2ZW50X2lkIjoiMzM3MDg4NDAtZjcxNS00NzgyLTkyNDMtOTBjZTg0NjlkZGM2IiwidG9rZW5fdXNlIjoiaWQiLCJhdXRoX3RpbWUiOjE3MDYyOTA1NTgsImV4cCI6MTcwNjI5MjU2MiwiaWF0IjoxNzA2MjkwNzYyLCJjdXN0b206cmM6Y2xpZW50SWQiOiIxMDE2NzIiLCJqdGkiOiI1ZjhmYzY1Zi00ZjlmLTRjNTEtOTQ4MS05MzU4YTQxNGQ1OWYiLCJlbWFpbCI6ImphbWVzcm90b3JmcmVhazY5QG91dGxvb2suY29tIn0.FJJdUNlMQssEUTY-7XMKHGWojH_2C6nx4I18tl-csKetFWKeZ86y6fdtkmtPsLqoP3Wi9WWZhM2W_nRcmFXsclQVsm4SqQ2jNJcmeaSZxC3RDo66YGFi4wO1GcYaviG0YIue81WDXVyUQx0n-8xmBIW6KcnDbb4MonjhSoCnbEpnxM47AoLIajL91n_Aqd7C5CrMCpGGhkl25Gjmj1zEHuxldjgvb196Qoql6MHrJW8j1P9RgA20_AZiursbH3cTGAqFYZ8JRiwizKdFiOB9i_n16vfnB6IHPkZkcrvp39fJZ7jKoFvJMc956dN3FqqNJlFiiRip3X98cQaPteHT6g',
    'content-type': 'application/json',
    'origin': 'https://my.referralcandy.com',
    'referer': 'https://my.referralcandy.com/',
    'sec-ch-ua': '"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'empty',
    'sec-fetch-mode': 'cors',
    'sec-fetch-site': 'same-site',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
}

    json_data = {
    'email': email,
    'subject': 'Aktion auf Ihrem Konto erforderlich!\n',
    'html': html_content,
    'plainText': 'Give your friends £15 off. Get £15 off when they shop with your link.\n\nStart by getting your invite link here: https://portal.referralcandy.com/SAMPLE/share_redirect?type=get_invite_link_email_click&location=reward_ineligible_email\n\nUnsubscribe: https://portal.referralcandy.com/SAMPLE/settings\n',
}

    response = requests.post(
    'https://api.referralcandy.com/v1/campaign/100948/theme/68566/send-test-email',
    headers=headers,
    json=json_data,
)

    return response

def main():
    emails = read_file_lines('emails.txt')
    html_content = ""

    with open('lettre.html', 'r') as html_file:
        html_content = html_file.read()

    for line_num, email in enumerate(emails, start=1):
        response = send_test_email(email, html_content)

        if response.status_code == 204:
            print(colorama.Fore.GREEN + f"{line_num}: Email sent to {email}")
        else:
            print(colorama.Fore.RED + f"{line_num}: Failed to send email to {email}")

        # Reset the console colors after each email
        print(colorama.Style.RESET_ALL)

        # Add a sleep of 3 seconds between requests
        time.sleep(3)

if __name__ == "__main__":
    main()
Leave a Comment