Add mail merge script #1

Merged
Tirsvad merged 1 commits from feat/mail-merge into main 2026-10-13 08:16:04 +02:00
11 changed files with 84 additions and 0 deletions
Showing only changes of commit d53af18f8a - Show all commits
+7
View File
@@ -0,0 +1,7 @@
Dear [name],
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+8
View File
@@ -0,0 +1,8 @@
Aang
Zuko
Appa
Katara
Sokka
Momo
Uncle Iroh
Toph
+7
View File
@@ -0,0 +1,7 @@
Dear Aang,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+7
View File
@@ -0,0 +1,7 @@
Dear Appa,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+7
View File
@@ -0,0 +1,7 @@
Dear Katara,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+7
View File
@@ -0,0 +1,7 @@
Dear Momo,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+7
View File
@@ -0,0 +1,7 @@
Dear Sokka,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+7
View File
@@ -0,0 +1,7 @@
Dear Toph,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
@@ -0,0 +1,7 @@
Dear Uncle Iroh,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+7
View File
@@ -0,0 +1,7 @@
Dear Zuko,
You are invited to my birthday this Saturday.
Hope you can make it!
Angela
+13
View File
@@ -0,0 +1,13 @@
PLACEHOLDER = "[name]"
with open("Input/Names/invited_names.txt") as names_file:
names = names_file.readlines()
with open("Input/Letters/starting_letter.txt") as letter_file:
letter_contents = letter_file.read()
for name in names:
stripped_name = name.strip()
new_letter = letter_contents.replace(PLACEHOLDER, stripped_name)
with open(f"Output/ReadyToSend/letter_for_{stripped_name}.txt", "w") as completed_letter:
completed_letter.write(new_letter)