remove hardcoded reply-to where it should be $addr, and add option for using local smtp
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE----- iQJDBAABCAAtFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmEj6CYPHG5pbGl4QG5p bGZtLmNjAAoJEDt/vCIUTmOYslwP/iH7nBQxWw9TSaYbGkL5IChGtNYJ2YQKBKtR fCTuUQkuba4YW4gagz25c4WsIHqFL1owu4UBMl+hWSWhq1tFLQLVIBIOCN3WQxY8 9CsHzexXlQTxFbzMlp/J9Hu9htUOyzRZ7QLQXr8PPTTPVLWoVulw0jomuCvVlMCh UqhXJ5I1ddV9rNXqYUBGK3ANHXeEeY6BsNLsXlAspRfLHwLndl3LbddH8c7NNOG4 DMztJtTON+yG5y29DtxCgxNH8HEGVZ27uKScxSyYJL7HG8yDQuvw37QFwrGA8V5e Xsc73ycdDch5J2DRyupTECsm3IqkUuQbx44ymWDLadvLc9pXVMHmW0TDFyI44ePk Dl84Zcnr4K4hQu58lM2creXGBVbVygpp3arITDdwKyGm1HSV8Sys3RccY5Rv6UVl lwc5y+LRx6PALTphOek+L1lDt33q1V+iLYoZjMIZydXJmDEpziSfFTdggiKf9lP4 4L9G3cbFWlr5iBlussCeEDFqU760GCcCfSAeBnL6JmkNO7rLifmx5gerAOpYBQEx e9dZTOysUzdZj8c+po9tW9AePrJrVDAxwH+m7WCsrVKq3UtuERFyCllxUs4badoF OAEwF/3pgLJLVs9x629ONLFFlZRByLjClKr10uR2Nlo8HZi6Qc6mvvf6z4wwGHyc jRkV8DJo =WtkI -----END PGP SIGNATURE-----
1 files changed,
26 insertions(+),
14 deletions(-)
jump to
M
mail2mms.sh
→
mail2mms.sh
@@ -1,11 +1,13 @@
#!/bin/sh # Send an MMS message to your phone when new emails come in. -# The message header will have the number of new mails in the subject, -# the From and Subject fields of up to the most recent 3 new mails, -# and 'and more...' if there are more than three new mails +# The message will have the number of new mails in the subject +# and the body will contain the From and Subject fields of up to the 3 +# most recent new mails. If the new mail count is above 3, there will also +# be 'and more...' at the end. # Assumes you have a maildir inbox on this machine; # you can use offlineimap or similar to sync recent mail to a maildir +# or use -l if this machine is actually your mailserver # import the config file ./.config # addr=<the address the notification will appear to be sent from>@@ -17,8 +19,11 @@ # smtp_password<the password to login to the smtp server>
. ./.config -if ! pgrep offlineimap; then - offlineimap & +if [ "$1" != -l ]; then + + if ! pgrep offlineimap; then + offlineimap & + fi fi oldnew=0@@ -42,15 +47,22 @@
while true; do newnew=$(ls -1 ${inbox}/new | wc -l) if [ ${newnew} -gt ${oldnew} ]; then - echo "$(summary)" \ - | mail -r nilix@nilfm.cc \ - -s "new mail [${newnew}]" \ - -S smtp=${smtp_server} \ - -S smtp-use-starttls \ - -S smtp-auth=login \ - -S smtp-auth-user=${smtp_user} \ - -S smtp-auth-password=${smtp_password} \ - ${phone} + if [ "$1" = -l ]; then + echo "$(summary)" \ + | mail -r ${addr} \ + -s "new mail [${newnew}]" \ + ${phone} + else + echo "$(summary)" \ + | mail -r ${addr} \ + -s "new mail [${newnew}]" \ + -S smtp=${smtp_server} \ + -S smtp-use-starttls \ + -S smtp-auth=login \ + -S smtp-auth-user=${smtp_user} \ + -S smtp-auth-password=${smtp_password} \ + ${phone} + fi fi oldnew=${newnew} sleep 2m