2 releases

0.1.1 Jan 18, 2021
0.1.0 Jan 18, 2021

#340 in Email

MIT license

12KB
215 lines

Email-template

Email template generator

use email_template::EmailMessage;

fn main() {
    let email_message = EmailMessage::create("./examples/email.txt", "./examples/data.json");
    let emails = email_message.build_emails();
    println!("{:?}", emails);
}

data.json

{
  "header": {
    "from": "user1 <user1@gmail.com>",
    "recipients": [
      "user2 <user2@gmail.com>",
      "user3 <user3@gmail.com>"
    ],
    "subject": "hello everyone"
  },
  "bodies": [{
    "name": "user2",
    "phone": "123-456-789",
    "company": "company1.",
    "text": "hi there, I hope you are doing well."
  },{
    "name": "user3",
    "phone": "777-888-999",
    "company": "company2.",
    "text": "hi there, I hope you are doing well."
  }]
}

email.txt

Dear {name},

{text} {name}
I am glad to invite you to our community.
Here's details, and let me know if you have any questions.

Looking forward to hearing from you soon.

Regards,
Somebody name,
{phone}
{company}

License

License: MIT

Dependencies

~4–15MB
~222K SLoC