2 个版本

0.1.1 2021 年 1 月 18 日
0.1.0 2021 年 1 月 18 日

#220电子邮件

MIT 许可证

12KB
215

Email-template

邮件模板生成器

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 <[email protected]>",
    "recipients": [
      "user2 <[email protected]>",
      "user3 <[email protected]>"
    ],
    "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: MIT

依赖项

~4–16MB
~228K SLoC