From e742e225653da5ebebc4f88a1b554b5d70bfb77d Mon Sep 17 00:00:00 2001 From: Shivang Date: Sat, 21 Oct 2023 15:44:44 +0530 Subject: [PATCH 1/4] added: html parsing for email generation --- scripts/mail-scripts/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/mail-scripts/main.go b/scripts/mail-scripts/main.go index f044a8d..c0b63f9 100644 --- a/scripts/mail-scripts/main.go +++ b/scripts/mail-scripts/main.go @@ -81,12 +81,18 @@ func send(body string, to []string) { panic(err) } + bodyContent, err := ioutil.ReadFile("email_body.html") + if err != nil { + log.Fatal(err) + } + m := gomail.NewMessage() for _, r := range to { + fmt.Printf("Sending email to: %s\n", r) m.SetHeader("From", from) m.SetAddressHeader("To", r, r) - m.SetHeader("Subject", "Newsletter Test") - m.SetBody("text/html", body) + m.SetHeader("Subject", "Mercurius Test") + m.SetBody("text/html", string(bodyContent)) if err := gomail.Send(s, m); err != nil { log.Printf("Could not send email to %q: %v", r, err) From bebaa88c1bff718dd13144d3e4c3baba0237df43 Mon Sep 17 00:00:00 2001 From: Shivang Date: Sat, 21 Oct 2023 15:45:39 +0530 Subject: [PATCH 2/4] added: sample template for email --- scripts/mail-scripts/email_body.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 scripts/mail-scripts/email_body.html diff --git a/scripts/mail-scripts/email_body.html b/scripts/mail-scripts/email_body.html new file mode 100644 index 0000000..d1f484e --- /dev/null +++ b/scripts/mail-scripts/email_body.html @@ -0,0 +1,17 @@ + + + + + + Mercurius + + +

Ahoy OSDC CT!

+

~~Sample Content of the mail to be sent~~

+

This mail marks the completion of back-end code. Feel free to customize this mail and + the mercurius website itself from github with + your own content CT, way to go!!!

+

Check out the website for mercurius.

+

Best regards,
OSDC

+ + From 82a24fa48a4adc3ace12f8cf85e31756acc177fa Mon Sep 17 00:00:00 2001 From: Shivang Date: Sat, 21 Oct 2023 15:53:34 +0530 Subject: [PATCH 3/4] updated: title and tag --- content/post/Example1.md | 6 +++--- themes/drizzle/layouts/index.html | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/content/post/Example1.md b/content/post/Example1.md index a0f462e..2f6fb40 100644 --- a/content/post/Example1.md +++ b/content/post/Example1.md @@ -1,8 +1,8 @@ --- -title: "Example" -date: 2021-04-15T16:26:49+05:30 +title: "Mercurius ;>" +date: 2023-10-21T14:00:00+05:30 --- -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \ No newline at end of file +Mercurius test drive fellas, let's see how soon can we get it done!!! \ No newline at end of file diff --git a/themes/drizzle/layouts/index.html b/themes/drizzle/layouts/index.html index ef86560..44247f2 100644 --- a/themes/drizzle/layouts/index.html +++ b/themes/drizzle/layouts/index.html @@ -1,7 +1,10 @@ {{ define "main" }}
- An OSDC Newsletter here, //probably in a cool font? And then hopefully a second line. + Open Source Developers Community (OSDC) +
+
+ May the source be with you ^-^
From b8899a8e9529ecaf85823b05edf5aed41442ce0d Mon Sep 17 00:00:00 2001 From: Shivang Date: Sat, 21 Oct 2023 16:24:12 +0530 Subject: [PATCH 4/4] updated: README --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 24a5a34..0336487 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,19 @@ # Mercurius -Community Newsletter Initiative +*A Community Newsletter Initiative developed and maintained by OSDC* + +## Setting up locally 🚀 + +- Install hugo on your system (steps vary with different OS). For convenience, refer this [link](https://gohugo.io/installation/). +- Download and install NodeJs from [here](https://nodejs.org/en/download) +- Fork and clone the project and follow these steps + - `cd Mercurius && npm i` to install npm based dependencies. + - `hugo serve` to start the local development server (localhost/port details will be available in console). + - To send out mail notifications, update email list from `scripts/mail-scripts/emails.json` followed by `cd scripts/mail-scripts && go run main.go` (though the email list and credentials needed to authenticate this operation will be confidential to maintainers only). + - Email template for the mail to be sent is written in HTML format and is super-easy to edit. You can contribute changes to it from `scripts/mail-scripts/email_body.html`, + +## Blog Submissions 📖 + +- Head to `content/post` +- Write the blog that you wish to publish in a md file and save it this folder. +- Be sure to include the header at the start of you blog's md (check `content/post/Example1.md`for more). +- Create a PR and notify the maintainers if your blog doesn't get published within a week.