[英]a better way to create an email template with bash
Using bash to create an email template:使用 bash 创建 email 模板:
#!/bin/bash
VAR1="today is "
VAR2="a good day"
echo "Good Morning" >> /tmp/email_template
echo $VAR1$VAR2 >> /tmp/email_template
echo "Best regards" >> /tmp/email_template
cat /tmp/email_template|mutt -s "Hello!" destination@gmail.com
is there something more clean to create an email template?有没有更干净的东西来创建 email 模板?
You can use a HERE doc as mentioned by a comment above or you can use a block like this:您可以使用上面评论中提到的 HERE 文档,也可以使用如下块:
#!/bin/bash
VAR1="today is "
VAR2="a good day"
{
echo "Good Morning"
echo "$VAR1$VAR2"
echo "Best regards"
} | mutt -s "Hello!" 'destination@gmail.com'
This is how you would do it using the HERE doc approach:这就是使用 HERE doc 方法的方法:
#!/bin/bash
VAR1="today is "
VAR2="a good day"
mutt -s "Hello!" destination@gmail.com <<EOF
Good Morning
$VAR1$VAR2
Best regards
EOF
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.