Skip to content

Instantly share code, notes, and snippets.

@ecounysis
Created February 7, 2012 00:05
Show Gist options
  • Save ecounysis/1756054 to your computer and use it in GitHub Desktop.
Save ecounysis/1756054 to your computer and use it in GitHub Desktop.
command line send mail
BEGIN {
body=0;
}
body==1 {a=a$0"\n";};
/^Body:/ {body=1;a=a" --body=\"";}
/^To:/ {a=a" -t"$2;}
/^From:/ {a=a" -f"$2;}
/^Subject:/ {a=a" -u\""$2"\"";}
/^Attachments:/ {
split($2, z, ",");
for (j in z)
a=a" -a"z[j];
}
END {
a=a"\""
print a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment