sbgonenc96 commited on
Commit
2dcc3b2
1 Parent(s): 5487bb2

initial commit

Browse files
Files changed (2) hide show
  1. app.py +52 -0
  2. requirements.txt +80 -0
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import yagmail
2
+ import gradio as gr
3
+ import os
4
+
5
+
6
+ def execute(file_txt, user_mail, google_api_key, subject_text, content):
7
+ import time
8
+ mail_list = str(file_txt.decode("utf-8")).split("\n")
9
+ if mail_list[-1] == "":
10
+ mail_list = mail_list[:-1]
11
+ yag = yagmail.SMTP(user_mail, os.getenv("GOOGLE_API_KEY", google_api_key))
12
+ print(mail_list)
13
+
14
+ for mail in mail_list:
15
+ yag.send(mail, subject_text, content)
16
+ time.sleep(0.2)
17
+
18
+ print("Mail gönderildi")
19
+
20
+ return True
21
+
22
+
23
+ with gr.Blocks() as demo:
24
+ gr.Markdown('Auto mailing')
25
+
26
+ with gr.Row():
27
+ file_input = gr.File(label='Mail listesini yükle', type='binary')
28
+
29
+ with gr.Row():
30
+ user_mail = gr.Text(label='Gönderen Mail adresi', value=None)
31
+ google_api_key = gr.Text(label="Google mail API anahtarı", value=None)
32
+
33
+ with gr.Row():
34
+ content = gr.Text(label='Gönderilecek mail metni', value="")
35
+
36
+ with gr.Row():
37
+ subject_text = gr.Text(label='Mail konusu', value="")
38
+
39
+ with gr.Row():
40
+ create_button = gr.Button('Gönder')
41
+
42
+ response = create_button.click(
43
+ execute,
44
+ inputs=[file_input, user_mail, google_api_key, subject_text, content],
45
+ )
46
+ if response:
47
+ gr.Info("Mail gönderildi")
48
+ else:
49
+ gr.Warning("HATA! Mail gönderilemedi")
50
+
51
+
52
+ demo.launch(share=False)
requirements.txt ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.2.1
2
+ altair==5.3.0
3
+ annotated-types==0.7.0
4
+ anyio==4.4.0
5
+ attrs==23.2.0
6
+ cachetools==5.3.3
7
+ certifi==2024.6.2
8
+ charset-normalizer==3.3.2
9
+ click==8.1.7
10
+ contourpy==1.2.1
11
+ cssselect==1.2.0
12
+ cssutils==2.11.1
13
+ cycler==0.12.1
14
+ dnspython==2.6.1
15
+ email_validator==2.2.0
16
+ exceptiongroup==1.2.1
17
+ fastapi==0.111.0
18
+ fastapi-cli==0.0.4
19
+ ffmpy==0.3.2
20
+ filelock==3.15.4
21
+ fonttools==4.53.0
22
+ fsspec==2024.6.0
23
+ gradio==4.37.1
24
+ gradio_client==1.0.2
25
+ h11==0.14.0
26
+ httpcore==1.0.5
27
+ httptools==0.6.1
28
+ httpx==0.27.0
29
+ huggingface-hub==0.23.4
30
+ idna==3.7
31
+ importlib_resources==6.4.0
32
+ Jinja2==3.1.4
33
+ jsonschema==4.22.0
34
+ jsonschema-specifications==2023.12.1
35
+ kiwisolver==1.4.5
36
+ lxml==5.2.2
37
+ markdown-it-py==3.0.0
38
+ MarkupSafe==2.1.5
39
+ matplotlib==3.9.0
40
+ mdurl==0.1.2
41
+ more-itertools==10.3.0
42
+ numpy==2.0.0
43
+ orjson==3.10.5
44
+ packaging==24.1
45
+ pandas==2.2.2
46
+ pillow==10.3.0
47
+ premailer==3.10.0
48
+ pydantic==2.7.4
49
+ pydantic_core==2.18.4
50
+ pydub==0.25.1
51
+ Pygments==2.18.0
52
+ pyparsing==3.1.2
53
+ python-dateutil==2.9.0.post0
54
+ python-dotenv==1.0.1
55
+ python-multipart==0.0.9
56
+ pytz==2024.1
57
+ PyYAML==6.0.1
58
+ referencing==0.35.1
59
+ requests==2.32.3
60
+ rich==13.7.1
61
+ rpds-py==0.18.1
62
+ ruff==0.4.10
63
+ semantic-version==2.10.0
64
+ shellingham==1.5.4
65
+ six==1.16.0
66
+ sniffio==1.3.1
67
+ starlette==0.37.2
68
+ tomlkit==0.12.0
69
+ toolz==0.12.1
70
+ tqdm==4.66.4
71
+ typer==0.12.3
72
+ typing_extensions==4.12.2
73
+ tzdata==2024.1
74
+ ujson==5.10.0
75
+ urllib3==2.2.2
76
+ uvicorn==0.30.1
77
+ uvloop==0.19.0
78
+ watchfiles==0.22.0
79
+ websockets==11.0.3
80
+ yagmail==0.15.293