LoginSignup
1
2

More than 1 year has passed since last update.

大量にメールを自動で送付する

Last updated at Posted at 2021-08-21

メールを大量送付できます。
recaptchaが出たときは回避できないので、手動でチェックした後に実行してください。

mail.py
from bs4 import BeautifulSoup
import urllib.request
import re
from time import sleep
from bs4 import BeautifulSoup
from selenium.webdriver.support.ui import WebDriverWait
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
import csv
import time
import datetime

# URL関連
#ログインIDとパスワード
address = ""
password = ""

#クロームをヘッドレスモードにする
options = Options()
#options.add_argument('--headless')
#開くURL
url = "https://m.kuku.lu/"
#クロームドライバーの指定とオプション
driver = webdriver.Chrome(executable_path="C:\code\python\chromedriver.exe", chrome_options=options)
# ログインページを開く
for num in range(100):
    driver.get(url)
    sleep(5)

    # ログオン処理
    # ユーザー名入力
    driver.find_element_by_id("link_addMailAddrByAuto").click()
    #print(driver.current_url)
    sleep(5)
    driver.find_element_by_id("link_newaddr_newmail").click()
    sleep(5)
    driver.find_elements_by_class_name("noborderinput")[0].send_keys(address)
    driver.find_elements_by_class_name("noborderinput")[1].send_keys("メール件名")
    driver.find_element_by_xpath('//*[@id="area_sendbutton"]/div/input').click()
    sleep(1)
    driver.find_element_by_id("area-confirm-dialog-button-ok").click()
    try:
        wait = WebDriverWait(driver, 30)
        wait.until(EC.alert_is_present())
        alert = driver.switch_to.alert
        print(alert.text)
        alert.accept()
    except TimeoutException:
        print("アラートは発生しませんでした")
    except Exception as e:
        print(e)
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2