mailyou 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mailyou-0.1.0/LICENSE ADDED
@@ -0,0 +1,131 @@
1
+ # PolyForm Noncommercial License 1.0.0
2
+
3
+ <https://polyformproject.org/licenses/noncommercial/1.0.0>
4
+
5
+ ## Acceptance
6
+
7
+ In order to get any license under these terms, you must agree
8
+ to them as both strict obligations and conditions to all
9
+ your licenses.
10
+
11
+ ## Copyright License
12
+
13
+ The licensor grants you a copyright license for the
14
+ software to do everything you might do with the software
15
+ that would otherwise infringe the licensor's copyright
16
+ in it for any permitted purpose. However, you may
17
+ only distribute the software according to [Distribution
18
+ License](#distribution-license) and make changes or new works
19
+ based on the software according to [Changes and New Works
20
+ License](#changes-and-new-works-license).
21
+
22
+ ## Distribution License
23
+
24
+ The licensor grants you an additional copyright license
25
+ to distribute copies of the software. Your license
26
+ to distribute covers distributing the software with
27
+ changes and new works permitted by [Changes and New Works
28
+ License](#changes-and-new-works-license).
29
+
30
+ ## Notices
31
+
32
+ You must ensure that anyone who gets a copy of any part of
33
+ the software from you also gets a copy of these terms or the
34
+ URL for them above, as well as copies of any plain-text lines
35
+ beginning with `Required Notice:` that the licensor provided
36
+ with the software. For example:
37
+
38
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
39
+
40
+ ## Changes and New Works License
41
+
42
+ The licensor grants you an additional copyright license to
43
+ make changes and new works based on the software for any
44
+ permitted purpose.
45
+
46
+ ## Patent License
47
+
48
+ The licensor grants you a patent license for the software that
49
+ covers patent claims the licensor can license, or becomes able
50
+ to license, that you would infringe by using the software.
51
+
52
+ ## Noncommercial Purposes
53
+
54
+ Any noncommercial purpose is a permitted purpose.
55
+
56
+ ## Personal Uses
57
+
58
+ Personal use for research, experiment, and testing for
59
+ the benefit of public knowledge, personal study, private
60
+ entertainment, hobby projects, amateur pursuits, or religious
61
+ observance, without any anticipated commercial application,
62
+ is use for a permitted purpose.
63
+
64
+ ## Noncommercial Organizations
65
+
66
+ Use by any charitable organization, educational institution,
67
+ public research organization, public safety or health
68
+ organization, environmental protection organization,
69
+ or government institution is use for a permitted purpose
70
+ regardless of the source of funding or obligations resulting
71
+ from the funding.
72
+
73
+ ## Fair Use
74
+
75
+ You may have "fair use" rights for the software under the
76
+ law. These terms do not limit them.
77
+
78
+ ## No Other Rights
79
+
80
+ These terms do not allow you to sublicense or transfer any of
81
+ your licenses to anyone else, or prevent the licensor from
82
+ granting licenses to anyone else. These terms do not imply
83
+ any other licenses.
84
+
85
+ ## Patent Defense
86
+
87
+ If you make any written claim that the software infringes or
88
+ contributes to infringement of any patent, your patent license
89
+ for the software granted under these terms ends immediately. If
90
+ your company makes such a claim, your patent license ends
91
+ immediately for work on behalf of your company.
92
+
93
+ ## Violations
94
+
95
+ The first time you are notified in writing that you have
96
+ violated any of these terms, or done anything with the software
97
+ not covered by your licenses, your licenses can nonetheless
98
+ continue if you come into full compliance with these terms,
99
+ and take practical steps to correct past violations, within
100
+ 32 days of receiving notice. Otherwise, all your licenses
101
+ end immediately.
102
+
103
+ ## No Liability
104
+
105
+ ***As far as the law allows, the software comes as is, without
106
+ any warranty or condition, and the licensor will not be liable
107
+ to you for any damages arising out of these terms or the use
108
+ or nature of the software, under any kind of legal claim.***
109
+
110
+ ## Definitions
111
+
112
+ The **licensor** is the individual or entity offering these
113
+ terms, and the **software** is the software the licensor makes
114
+ available under these terms.
115
+
116
+ **You** refers to the individual or entity agreeing to these
117
+ terms.
118
+
119
+ **Your company** is any legal entity, sole proprietorship,
120
+ or other kind of organization that you work for, plus all
121
+ organizations that have control over, are under the control of,
122
+ or are under common control with that organization. **Control**
123
+ means ownership of substantially all the assets of an entity,
124
+ or the power to direct its management and policies by vote,
125
+ contract, or otherwise. Control can be direct or indirect.
126
+
127
+ **Your licenses** are all the licenses granted to you for the
128
+ software under these terms.
129
+
130
+ **Use** means anything you do with the software requiring one
131
+ of your licenses.
mailyou-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,128 @@
1
+ Metadata-Version: 2.4
2
+ Name: mailyou
3
+ Version: 0.1.0
4
+ Summary: Send emails straight from your CLI
5
+ License-Expression: PolyForm-Noncommercial-1.0.0
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: python-dotenv>=1.2.2
10
+ Dynamic: license-file
11
+
12
+ # MailYou
13
+
14
+ Send emails straight from your CLI!
15
+
16
+ ## How to use
17
+
18
+ Clone the repo:
19
+
20
+ ```bash
21
+ git clone https://github.com/aiadam36/MailYou.git
22
+ cd MailYou
23
+ ```
24
+
25
+ Install dependencies:
26
+
27
+ ```bash
28
+ pip install .
29
+ ```
30
+
31
+ Configure the `.env`:
32
+
33
+ ```bash
34
+ cp .env.example .env
35
+ ```
36
+
37
+ And then fill your credentials and recipient addresses
38
+
39
+ > We also supports **Cc**, **Bcc**, **Reply-To** and attachment! Simply fill it in `.env` file
40
+
41
+ After that, run any of this command:
42
+
43
+ ```bash
44
+ cp examples/email.txt email.txt # Use our plain text template
45
+ ```
46
+
47
+ Or for an HTML email:
48
+
49
+ ```bash
50
+ cp examples/email.html email.html # Use our HTML template
51
+ ```
52
+
53
+ Or basically write your own from scratch:
54
+
55
+ ```bash
56
+ touch email.txt # plain text
57
+ touch email.html # HTML
58
+ ```
59
+
60
+ The file extension determines how the email is sent: `.txt` sends as plain text, `.html` sends as HTML. Any other extension will produce an error
61
+
62
+ And then run `mailyou -t FILE` to send them
63
+
64
+ `FILE` is your email file name
65
+
66
+ > `mailyou --target FILE` is also valid
67
+
68
+ We use `-t` or `--target` to specify the path of the email file, so it's not necessary to name them all `email.txt` or `email.html`
69
+
70
+ ### How to write the email (Especially if you used `touch`)
71
+
72
+ The script parses email files exactly like these:
73
+
74
+ - **Line 1** is the subject
75
+ - **Line 2** is a separator (must be blank)
76
+ - **Line 3+** is the email body
77
+
78
+ > For subject and email body, you can always leave them blank if you don't want any, but **line 2** must always be blank
79
+
80
+ If any of these requirements are not satisfied, the script will print an error and won't send
81
+
82
+ ---
83
+
84
+ This structure is the same for both `.txt` and `.html` files. The only difference is that **line 3 onward is treated as raw HTML** when using a `.html` file
85
+
86
+ ### Example plain text email
87
+
88
+ This is an example of a valid `email.txt`:
89
+
90
+ ```
91
+ Sample Message
92
+
93
+ Hello,
94
+
95
+ Lorem ipsum style placeholder email content for testing purposes
96
+
97
+ Thank you.
98
+ ```
99
+
100
+ ### Example HTML email
101
+
102
+ This is an example of a valid `email.html`:
103
+
104
+ ```
105
+ Sample Message
106
+
107
+ <html>
108
+ <body>
109
+ <p>Hello</p>
110
+ <p>Lorem ipsum style placeholder email content for testing purposes</p>
111
+ <p>Thank you</p>
112
+ </body>
113
+ </html>
114
+ ```
115
+
116
+ #### Breakdown (applies to both formats)
117
+
118
+ - **Line 1** `Sample Message` is the subject
119
+
120
+ - **Line 2** (blank) is the separator
121
+
122
+ - **Line 3+** is the body: plain text for `.txt`, raw HTML markup for `.html`
123
+
124
+ > **FYI**, for plain text emails we handle linebreaks automatically by injecting `\n` starting from **line 3** and so on. For HTML emails, your markup controls all formatting
125
+
126
+ ## Contributing
127
+
128
+ We're restricting PR access, sorry.
@@ -0,0 +1,117 @@
1
+ # MailYou
2
+
3
+ Send emails straight from your CLI!
4
+
5
+ ## How to use
6
+
7
+ Clone the repo:
8
+
9
+ ```bash
10
+ git clone https://github.com/aiadam36/MailYou.git
11
+ cd MailYou
12
+ ```
13
+
14
+ Install dependencies:
15
+
16
+ ```bash
17
+ pip install .
18
+ ```
19
+
20
+ Configure the `.env`:
21
+
22
+ ```bash
23
+ cp .env.example .env
24
+ ```
25
+
26
+ And then fill your credentials and recipient addresses
27
+
28
+ > We also supports **Cc**, **Bcc**, **Reply-To** and attachment! Simply fill it in `.env` file
29
+
30
+ After that, run any of this command:
31
+
32
+ ```bash
33
+ cp examples/email.txt email.txt # Use our plain text template
34
+ ```
35
+
36
+ Or for an HTML email:
37
+
38
+ ```bash
39
+ cp examples/email.html email.html # Use our HTML template
40
+ ```
41
+
42
+ Or basically write your own from scratch:
43
+
44
+ ```bash
45
+ touch email.txt # plain text
46
+ touch email.html # HTML
47
+ ```
48
+
49
+ The file extension determines how the email is sent: `.txt` sends as plain text, `.html` sends as HTML. Any other extension will produce an error
50
+
51
+ And then run `mailyou -t FILE` to send them
52
+
53
+ `FILE` is your email file name
54
+
55
+ > `mailyou --target FILE` is also valid
56
+
57
+ We use `-t` or `--target` to specify the path of the email file, so it's not necessary to name them all `email.txt` or `email.html`
58
+
59
+ ### How to write the email (Especially if you used `touch`)
60
+
61
+ The script parses email files exactly like these:
62
+
63
+ - **Line 1** is the subject
64
+ - **Line 2** is a separator (must be blank)
65
+ - **Line 3+** is the email body
66
+
67
+ > For subject and email body, you can always leave them blank if you don't want any, but **line 2** must always be blank
68
+
69
+ If any of these requirements are not satisfied, the script will print an error and won't send
70
+
71
+ ---
72
+
73
+ This structure is the same for both `.txt` and `.html` files. The only difference is that **line 3 onward is treated as raw HTML** when using a `.html` file
74
+
75
+ ### Example plain text email
76
+
77
+ This is an example of a valid `email.txt`:
78
+
79
+ ```
80
+ Sample Message
81
+
82
+ Hello,
83
+
84
+ Lorem ipsum style placeholder email content for testing purposes
85
+
86
+ Thank you.
87
+ ```
88
+
89
+ ### Example HTML email
90
+
91
+ This is an example of a valid `email.html`:
92
+
93
+ ```
94
+ Sample Message
95
+
96
+ <html>
97
+ <body>
98
+ <p>Hello</p>
99
+ <p>Lorem ipsum style placeholder email content for testing purposes</p>
100
+ <p>Thank you</p>
101
+ </body>
102
+ </html>
103
+ ```
104
+
105
+ #### Breakdown (applies to both formats)
106
+
107
+ - **Line 1** `Sample Message` is the subject
108
+
109
+ - **Line 2** (blank) is the separator
110
+
111
+ - **Line 3+** is the body: plain text for `.txt`, raw HTML markup for `.html`
112
+
113
+ > **FYI**, for plain text emails we handle linebreaks automatically by injecting `\n` starting from **line 3** and so on. For HTML emails, your markup controls all formatting
114
+
115
+ ## Contributing
116
+
117
+ We're restricting PR access, sorry.
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mailyou"
7
+ version = "0.1.0"
8
+ description = "Send emails straight from your CLI"
9
+ readme = "README.md"
10
+ license = "PolyForm-Noncommercial-1.0.0"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ dependencies = [
14
+ "python-dotenv>=1.2.2",
15
+ ]
16
+
17
+ [project.scripts]
18
+ mailyou = "mailyou.cli:main"
19
+
20
+ [tool.setuptools.packages.find]
21
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,12 @@
1
+ from .attachment import attach_files, parse_attachments
2
+ from .config import Config
3
+ from .parser import parse_email_file
4
+ from .sender import send
5
+
6
+ __all__ = [
7
+ "Config",
8
+ "parse_email_file",
9
+ "parse_attachments",
10
+ "attach_files",
11
+ "send",
12
+ ]
@@ -0,0 +1,4 @@
1
+ import sys
2
+ from .cli import main
3
+
4
+ sys.exit(main())
@@ -0,0 +1,31 @@
1
+ from __future__ import annotations
2
+
3
+ import mimetypes
4
+ import os
5
+ from email.message import EmailMessage
6
+
7
+
8
+ def parse_attachments(paths: list[str]) -> list[str]:
9
+ for path in paths:
10
+ if not os.path.exists(path):
11
+ raise FileNotFoundError(f"Attachment not found: {path!r}")
12
+ if not os.path.isfile(path):
13
+ raise ValueError(f"Attachment path is not a file: {path!r}")
14
+ return paths
15
+
16
+
17
+ def attach_files(msg: EmailMessage, paths: list[str]) -> None:
18
+ for path in paths:
19
+ mime_type, _ = mimetypes.guess_type(path)
20
+ if mime_type is None:
21
+ mime_type = "application/octet-stream"
22
+ maintype, subtype = mime_type.split("/", 1)
23
+ filename = os.path.basename(path)
24
+ with open(path, "rb") as fh:
25
+ msg.add_attachment(
26
+ fh.read(),
27
+ maintype=maintype,
28
+ subtype=subtype,
29
+ filename=filename,
30
+ )
31
+ print(f"Attached: {filename} ({mime_type})")
@@ -0,0 +1,53 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+
6
+ from .config import Config
7
+ from .parser import parse_email_file
8
+ from .sender import send
9
+
10
+
11
+ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
12
+ parser = argparse.ArgumentParser(
13
+ prog="mailyou",
14
+ description="Send an email from the CLI",
15
+ )
16
+ parser.add_argument(
17
+ "-t", "--target",
18
+ required=True,
19
+ metavar="FILE",
20
+ help="Path to the email file (.txt or .html)",
21
+ )
22
+ return parser.parse_args(argv)
23
+
24
+
25
+ def main(argv: list[str] | None = None) -> int:
26
+ args = parse_args(argv)
27
+
28
+ try:
29
+ config = Config.from_env()
30
+ except (EnvironmentError, ValueError) as exc:
31
+ print(f"Configuration error: {exc}", file=sys.stderr)
32
+ return 1
33
+
34
+ try:
35
+ subject, body, content_type = parse_email_file(args.target)
36
+ except (FileNotFoundError, ValueError) as exc:
37
+ print(f"Error reading {args.target!r}: {exc}", file=sys.stderr)
38
+ return 1
39
+
40
+ try:
41
+ send(subject, body, content_type, config)
42
+ except (FileNotFoundError, ValueError) as exc:
43
+ print(f"Attachment error: {exc}", file=sys.stderr)
44
+ return 1
45
+ except Exception as exc:
46
+ print(f"Failed to send email: {exc}", file=sys.stderr)
47
+ return 1
48
+
49
+ return 0
50
+
51
+
52
+ if __name__ == "__main__":
53
+ sys.exit(main())
@@ -0,0 +1,73 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ from dataclasses import dataclass, field
5
+
6
+ from dotenv import load_dotenv
7
+
8
+
9
+ def _load_addresses(key: str) -> list[str]:
10
+ raw = os.getenv(key, "")
11
+ return [addr.strip() for addr in raw.split(",") if addr.strip()]
12
+
13
+
14
+ def _load_port() -> int:
15
+ raw = os.getenv("SMTP_PORT", "587")
16
+ try:
17
+ return int(raw)
18
+ except ValueError:
19
+ raise ValueError(f"SMTP_PORT must be an integer, got: {raw!r}")
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class Config:
24
+ smtp_server: str
25
+ smtp_port: int
26
+ smtp_user: str
27
+ smtp_pass: str
28
+ mail_from: str
29
+ mail_to: list[str]
30
+ mail_cc: list[str] = field(default_factory=list)
31
+ mail_bcc: list[str] = field(default_factory=list)
32
+ mail_reply_to: list[str] = field(default_factory=list)
33
+ mail_attachments: list[str] = field(default_factory=list)
34
+
35
+ @classmethod
36
+ def from_env(cls, dotenv_path: str | None = None) -> "Config":
37
+ load_dotenv(dotenv_path)
38
+
39
+ smtp_server = os.getenv("SMTP_SERVER", "")
40
+ smtp_user = os.getenv("SMTP_USER", "")
41
+ smtp_pass = os.getenv("SMTP_PASS", "")
42
+ mail_to = _load_addresses("MAIL_TO")
43
+
44
+ missing = [
45
+ name
46
+ for name, val in [
47
+ ("SMTP_SERVER", smtp_server),
48
+ ("SMTP_USER", smtp_user),
49
+ ("SMTP_PASS", smtp_pass),
50
+ ]
51
+ if not val
52
+ ] + ([] if mail_to else ["MAIL_TO"])
53
+
54
+ if missing:
55
+ raise EnvironmentError(
56
+ f"Missing required .env variable(s): {', '.join(missing)}"
57
+ )
58
+
59
+ raw_attachments = os.getenv("MAIL_ATTACHMENTS", "")
60
+ attachment_paths = [p.strip() for p in raw_attachments.split(",") if p.strip()]
61
+
62
+ return cls(
63
+ smtp_server=smtp_server,
64
+ smtp_port=_load_port(),
65
+ smtp_user=smtp_user,
66
+ smtp_pass=smtp_pass,
67
+ mail_from=os.getenv("MAIL_FROM", smtp_user),
68
+ mail_to=mail_to,
69
+ mail_cc=_load_addresses("MAIL_CC"),
70
+ mail_bcc=_load_addresses("MAIL_BCC"),
71
+ mail_reply_to=_load_addresses("MAIL_REPLY_TO"),
72
+ mail_attachments=attachment_paths,
73
+ )
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+
5
+ _SUPPORTED_EXTENSIONS: dict[str, str] = {
6
+ ".txt": "plain",
7
+ ".html": "html",
8
+ }
9
+
10
+
11
+ def parse_email_file(path: str) -> tuple[str, str, str]:
12
+ if not os.path.exists(path):
13
+ raise FileNotFoundError(f"Email file not found: {path!r}")
14
+
15
+ ext = os.path.splitext(path)[1].lower()
16
+ content_type = _SUPPORTED_EXTENSIONS.get(ext)
17
+ if content_type is None:
18
+ supported = ", ".join(_SUPPORTED_EXTENSIONS)
19
+ raise ValueError(
20
+ f"Unsupported file extension {ext!r}. Supported: {supported}"
21
+ )
22
+
23
+ with open(path, "r", encoding="utf-8") as fh:
24
+ lines = fh.read().splitlines()
25
+
26
+ if not lines:
27
+ raise ValueError("Email file is completely empty")
28
+
29
+ subject = lines[0].strip()
30
+
31
+ if len(lines) == 1:
32
+ return subject, "", content_type
33
+
34
+ if lines[1].strip() != "":
35
+ raise ValueError(
36
+ "Line 2 must be completely blank"
37
+ )
38
+
39
+ body = "\n".join(lines[2:])
40
+
41
+ return subject, body, content_type
@@ -0,0 +1,54 @@
1
+ from __future__ import annotations
2
+
3
+ import smtplib
4
+ from email.message import EmailMessage
5
+
6
+ from .attachment import attach_files, parse_attachments
7
+ from .config import Config
8
+
9
+
10
+ def send(subject: str, body: str, content_type: str, config: Config) -> None:
11
+ attachment_paths = parse_attachments(config.mail_attachments)
12
+
13
+ msg = EmailMessage()
14
+ msg["From"] = config.mail_from
15
+ msg["To"] = ", ".join(config.mail_to)
16
+ msg["Subject"] = subject
17
+
18
+ if config.mail_cc:
19
+ msg["Cc"] = ", ".join(config.mail_cc)
20
+
21
+ if config.mail_reply_to:
22
+ msg["Reply-To"] = ", ".join(config.mail_reply_to)
23
+
24
+ msg.set_content(body, subtype=content_type)
25
+
26
+ if attachment_paths:
27
+ attach_files(msg, attachment_paths)
28
+
29
+ all_recipients = config.mail_to + config.mail_cc + config.mail_bcc
30
+
31
+ print(f"Connecting to {config.smtp_server}:{config.smtp_port}...")
32
+ with smtplib.SMTP(config.smtp_server, config.smtp_port) as smtp:
33
+ smtp.starttls()
34
+ print("TLS enabled")
35
+
36
+ smtp.login(config.smtp_user, config.smtp_pass)
37
+ print("Authenticated")
38
+
39
+ smtp.sendmail(config.mail_from, all_recipients, msg.as_string())
40
+
41
+ _print_summary(config, attachment_paths)
42
+
43
+
44
+ def _print_summary(config: Config, attachment_paths: list[str]) -> None:
45
+ parts = [f"To: {', '.join(config.mail_to)}"]
46
+ if config.mail_cc:
47
+ parts.append(f"CC: {', '.join(config.mail_cc)}")
48
+ if config.mail_bcc:
49
+ parts.append(f"BCC: {', '.join(config.mail_bcc)}")
50
+ if config.mail_reply_to:
51
+ parts.append(f"Reply-To: {', '.join(config.mail_reply_to)}")
52
+ if attachment_paths:
53
+ parts.append(f"Attachments: {len(attachment_paths)}")
54
+ print(f"Email sent successfully! ({' | '.join(parts)})")
@@ -0,0 +1,128 @@
1
+ Metadata-Version: 2.4
2
+ Name: mailyou
3
+ Version: 0.1.0
4
+ Summary: Send emails straight from your CLI
5
+ License-Expression: PolyForm-Noncommercial-1.0.0
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: python-dotenv>=1.2.2
10
+ Dynamic: license-file
11
+
12
+ # MailYou
13
+
14
+ Send emails straight from your CLI!
15
+
16
+ ## How to use
17
+
18
+ Clone the repo:
19
+
20
+ ```bash
21
+ git clone https://github.com/aiadam36/MailYou.git
22
+ cd MailYou
23
+ ```
24
+
25
+ Install dependencies:
26
+
27
+ ```bash
28
+ pip install .
29
+ ```
30
+
31
+ Configure the `.env`:
32
+
33
+ ```bash
34
+ cp .env.example .env
35
+ ```
36
+
37
+ And then fill your credentials and recipient addresses
38
+
39
+ > We also supports **Cc**, **Bcc**, **Reply-To** and attachment! Simply fill it in `.env` file
40
+
41
+ After that, run any of this command:
42
+
43
+ ```bash
44
+ cp examples/email.txt email.txt # Use our plain text template
45
+ ```
46
+
47
+ Or for an HTML email:
48
+
49
+ ```bash
50
+ cp examples/email.html email.html # Use our HTML template
51
+ ```
52
+
53
+ Or basically write your own from scratch:
54
+
55
+ ```bash
56
+ touch email.txt # plain text
57
+ touch email.html # HTML
58
+ ```
59
+
60
+ The file extension determines how the email is sent: `.txt` sends as plain text, `.html` sends as HTML. Any other extension will produce an error
61
+
62
+ And then run `mailyou -t FILE` to send them
63
+
64
+ `FILE` is your email file name
65
+
66
+ > `mailyou --target FILE` is also valid
67
+
68
+ We use `-t` or `--target` to specify the path of the email file, so it's not necessary to name them all `email.txt` or `email.html`
69
+
70
+ ### How to write the email (Especially if you used `touch`)
71
+
72
+ The script parses email files exactly like these:
73
+
74
+ - **Line 1** is the subject
75
+ - **Line 2** is a separator (must be blank)
76
+ - **Line 3+** is the email body
77
+
78
+ > For subject and email body, you can always leave them blank if you don't want any, but **line 2** must always be blank
79
+
80
+ If any of these requirements are not satisfied, the script will print an error and won't send
81
+
82
+ ---
83
+
84
+ This structure is the same for both `.txt` and `.html` files. The only difference is that **line 3 onward is treated as raw HTML** when using a `.html` file
85
+
86
+ ### Example plain text email
87
+
88
+ This is an example of a valid `email.txt`:
89
+
90
+ ```
91
+ Sample Message
92
+
93
+ Hello,
94
+
95
+ Lorem ipsum style placeholder email content for testing purposes
96
+
97
+ Thank you.
98
+ ```
99
+
100
+ ### Example HTML email
101
+
102
+ This is an example of a valid `email.html`:
103
+
104
+ ```
105
+ Sample Message
106
+
107
+ <html>
108
+ <body>
109
+ <p>Hello</p>
110
+ <p>Lorem ipsum style placeholder email content for testing purposes</p>
111
+ <p>Thank you</p>
112
+ </body>
113
+ </html>
114
+ ```
115
+
116
+ #### Breakdown (applies to both formats)
117
+
118
+ - **Line 1** `Sample Message` is the subject
119
+
120
+ - **Line 2** (blank) is the separator
121
+
122
+ - **Line 3+** is the body: plain text for `.txt`, raw HTML markup for `.html`
123
+
124
+ > **FYI**, for plain text emails we handle linebreaks automatically by injecting `\n` starting from **line 3** and so on. For HTML emails, your markup controls all formatting
125
+
126
+ ## Contributing
127
+
128
+ We're restricting PR access, sorry.
@@ -0,0 +1,16 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/mailyou/__init__.py
5
+ src/mailyou/__main__.py
6
+ src/mailyou/attachment.py
7
+ src/mailyou/cli.py
8
+ src/mailyou/config.py
9
+ src/mailyou/parser.py
10
+ src/mailyou/sender.py
11
+ src/mailyou.egg-info/PKG-INFO
12
+ src/mailyou.egg-info/SOURCES.txt
13
+ src/mailyou.egg-info/dependency_links.txt
14
+ src/mailyou.egg-info/entry_points.txt
15
+ src/mailyou.egg-info/requires.txt
16
+ src/mailyou.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mailyou = mailyou.cli:main
@@ -0,0 +1 @@
1
+ python-dotenv>=1.2.2
@@ -0,0 +1 @@
1
+ mailyou