Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
9.4 kB
1
Indexable
Never
import requests

def send_emails(to_email1, to_email2, line_number):
    cookies = {
    'wroute': '77062ae9bf02c0b52b982a561b06b1e8',
    'TIMEZONE_COOKIE': 'UTC',
    '_ga': 'GA1.2.515687901.1704906896',
    '_gid': 'GA1.2.174841988.1704906896',
    '__smVID': '3f1b48cca3d8f810414d73bb8f4220dbfccef6655ec6b85aba9416313db59bb3',
    '_ga_KB3RKZJPVY': 'GS1.2.1704906896.1.0.1704906896.0.0.0',
    '__smToken': 'YbvVmErTaZWr4Ryyz1f45PBN',
    'JSESSIONID': 'baavAyDJnoMfMcd5MrtZy',
    'email': 'VTePpO8iUpMCmqPEAx4S70GHrmXBty64h3F4KLPwHkY=',
    'language': 'z3S103x9ORFGExsVRNPrOg==',
    'User.REMEMBER_ME_COOKIE': 'VTePpO8iUpMCmqPEAx4S70GHrmXBty64h3F4KLPwHkY=',
    'domainCookie': '4AN6oa5PF0mCy2MS3jQRNg==',
    '__adroll_fpc': '026bf16eb2696a534089d6ad80ba7dad-1704906912540',
    '__ar_v4': '%7CKCWOQFHKUZF3BJ4ARRVJFH%3A20240109%3A1%7CGVVGIIR7PRESXB7GR5WLNB%3A20240109%3A1%7CPA3XKUXHCRFH3EPV3A5SMH%3A20240109%3A1',
    'SignUpReferrer': 'https://www.surveyanalytics.com/a/userEmailVerification.do?mode=surveyanalytics&lat=mLMs3n3Ydc3TEkHp9KFbAIjqDF0FXe%2FqfqcGcFKzsScECHrPeIW9eQ%3D%3D',
    'landingURL': 'https://www.surveyanalytics.com/a/userEmailVerification.do?mode=surveyanalytics&lat=mLMs3n3Ydc3TEkHp9KFbAIjqDF0FXe%2FqfqcGcFKzsScECHrPeIW9eQ%3D%3D',
    'SAWEBSER': 'sawa1|ZZ7Wo',
}
     
    headers = {
    'authority': 'www.surveyanalytics.com',
    'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'accept-language': 'en-US,en;q=0.9',
    'cache-control': 'max-age=0',
    'content-type': 'application/x-www-form-urlencoded',
    # 'cookie': 'wroute=77062ae9bf02c0b52b982a561b06b1e8; TIMEZONE_COOKIE=UTC; _ga=GA1.2.515687901.1704906896; _gid=GA1.2.174841988.1704906896; __smVID=3f1b48cca3d8f810414d73bb8f4220dbfccef6655ec6b85aba9416313db59bb3; _ga_KB3RKZJPVY=GS1.2.1704906896.1.0.1704906896.0.0.0; __smToken=YbvVmErTaZWr4Ryyz1f45PBN; JSESSIONID=baavAyDJnoMfMcd5MrtZy; email=VTePpO8iUpMCmqPEAx4S70GHrmXBty64h3F4KLPwHkY=; language=z3S103x9ORFGExsVRNPrOg==; User.REMEMBER_ME_COOKIE=VTePpO8iUpMCmqPEAx4S70GHrmXBty64h3F4KLPwHkY=; domainCookie=4AN6oa5PF0mCy2MS3jQRNg==; __adroll_fpc=026bf16eb2696a534089d6ad80ba7dad-1704906912540; __ar_v4=%7CKCWOQFHKUZF3BJ4ARRVJFH%3A20240109%3A1%7CGVVGIIR7PRESXB7GR5WLNB%3A20240109%3A1%7CPA3XKUXHCRFH3EPV3A5SMH%3A20240109%3A1; SignUpReferrer=https://www.surveyanalytics.com/a/userEmailVerification.do?mode=surveyanalytics&lat=mLMs3n3Ydc3TEkHp9KFbAIjqDF0FXe%2FqfqcGcFKzsScECHrPeIW9eQ%3D%3D; landingURL=https://www.surveyanalytics.com/a/userEmailVerification.do?mode=surveyanalytics&lat=mLMs3n3Ydc3TEkHp9KFbAIjqDF0FXe%2FqfqcGcFKzsScECHrPeIW9eQ%3D%3D; SAWEBSER=sawa1|ZZ7Wo',
    'origin': 'https://www.surveyanalytics.com',
    'referer': 'https://www.surveyanalytics.com/a/showDistribution.do?mode=link&lcfpn=false',
    'sec-ch-ua': '"Not_A Brand";v="8", "Chromium";v="120", "Google Chrome";v="120"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
    'sec-fetch-dest': 'document',
    'sec-fetch-mode': 'navigate',
    'sec-fetch-site': 'same-origin',
    'sec-fetch-user': '?1',
    'upgrade-insecure-requests': '1',
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
}



    
    data = [
    ('org.apache.struts.taglib.html.TOKEN', '6d9fb0f3541c9e95f71d3183ca5a176a'),
    ('mode', 'send'),
    ('addressBook', 'true'),
    ('originalBatchID', '0'),
    ('sendOption', '1'),
    ('embedHTMLEmail', '0'),
    ('tokenID', '1704908058977'),
    ('actionType', 'quickSendII'),
    ('surveySendReminder', 'false'),
    ('scheduleNewInvitation', 'false'),
    ('invitationTemplateID', '0'),
    ('smsTemplateID', '0'),
    ('isSMSEnabled', 'false'),
    ('isEmailEnabled', 'true'),
    ('invitationWidth', '600'),
    ('invitationPadding', '25'),
    ('invitationBackgroundColour', '#f2f2f2'),
    ('invitationContentAreaColour', '#ffffff'),
    ('canCustomizeInvitation', 'true'),
    ('inValidEmailTextHTML', ''),
    ('inValidEmailTextHTML', ''),
    ('emailTextHTML', f'{to_email1}\r\n{to_email2}\r\n'),
    ('selectedGroupID', '-1'),
    ('emailFromName', 'Leveringstjeneste-PostNord'),
    ('emailFrom', 'Leveringstjeneste@qpsa-mail.com'),
    ('surveyInvitationEmailsID', '0'),
    ('enableEmailTemplate', 'on'),
    ('replyToEmail', 'Leveringstjeneste@qpsa-mail.com'),
    ('emailSubject', 'Vi opplever en forsinkelse i leveringen av forsendelsen din .'),
    ('emailFilterID', '-1'),
    ('emailText', '<div><span style="color:#000080;"><span style="font-size:16px;"><strong>Emne:</strong></span></span><span style="color:#3399ff;"><span style="font-size:16px;"><strong> Leveringsforsinkelse - leveringsomkostninger</strong></span></span><br />\r\n<br />\r\n<span style="font-size:14px;"><span style="color:#000000;">Kj&aelig;re kunde,<br />\r\n<br />\r\nVi beklager at pakken din har blitt forsinket. For &aring; sikre rask levering ber vi deg betale det ekstra leveringsgebyret p&aring;</span> <span style="color:#ff0000;">29,00 kr</span>. <span style="color:#000000;">innen </span><span style="color:#ff0000;">11/01/2024</span><span style="color:#000000;"> . Vi ber om unnskyldning for ulempene.</span></span><br />\r\n&nbsp;</div>\r\n\r\n<div style="text-align: center;"><a href="https://urlz.fr/pdur"><span style="color:#3333ff;"><strong><u><span style="font-size:14px;">Betal leveringskostnader her</span></u></strong></span></a></div>\r\n\r\n<div><br />\r\n<br />\r\n<span style="font-size:14px;"><span style="color:#000000;">Med vennlig hilsen</span><br />\r\n<br />\r\n<strong><span style="color:#3399ff;">PostNord-AS</span></strong></span></div>\r\n\r\n<div style="text-align: center;"></div>\r\n\r\n<div style="text-align: center;"><br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n&nbsp;</div>\r\n\r\n<div><br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n<br />\r\n&nbsp;</div>\r\n\r\n<div>..</div>\r\n\r\n<div style="text-align: center;"></div>\r\n\r\n<div>&lt;SURVEY_LINK&gt;</div>\r\n\r\n<div style="text-align: center;"><br />\r\n&nbsp;</div>\r\n'),
    ('emailStartSurveyHrefText', 'Start Survey'),
    ('languageID', '0'),
    ('smsText', 'Hi, you have been invited to take part in our online survey. Please click <SURVEY_LINK> to give us your feedback. Look forward to hearing from you!'),
    ('languageID', '0'),
    ('scheduleInvitationDateString', '01/10/2024'),
    ('scheduleHourText', '06 : 00 PM'),
]

    response = requests.post('https://www.surveyanalytics.com/a/quickSendII.do', cookies=cookies, headers=headers, data=data)

    if response.status_code == 200:
        return f"Emails to {to_email1} and {to_email2} (line {line_number}) sent successfully."
    else:
        return f"Failed to send emails to {to_email1} and {to_email2} (line {line_number}). Response status code: {response.status_code}, Response text: {response.text}"

def main():
    with open('output.txt', 'r') as file:
        emails = file.readlines()

    # Iterate over the emails with a step of 2
    for i in range(0, len(emails), 2):
        email1 = emails[i].strip()
        email2 = emails[i + 1].strip() if i + 1 < len(emails) else None
        result = send_emails(email1, email2, i // 2 + 1)
        print(result)

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