How to add subject line when sending email output of find using ssmtp
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I got a script running (as cronjob) that will list the files in a folder before doing a Rsync job and emailing me the list. How can I add a subject line.
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | ssmtp my_email@domain.com
I tried this with -s "Subject" but no luck. It only works if I put the subject in a text file and call this text file
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | my_email@domain.com < /path/to/file/subjectline.txt
But than it won't add the search results in the Message.
Any thoughts on what I am doing wrong,
Bas
shell find cron ssmtp
add a comment |Â
up vote
1
down vote
favorite
I got a script running (as cronjob) that will list the files in a folder before doing a Rsync job and emailing me the list. How can I add a subject line.
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | ssmtp my_email@domain.com
I tried this with -s "Subject" but no luck. It only works if I put the subject in a text file and call this text file
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | my_email@domain.com < /path/to/file/subjectline.txt
But than it won't add the search results in the Message.
Any thoughts on what I am doing wrong,
Bas
shell find cron ssmtp
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I got a script running (as cronjob) that will list the files in a folder before doing a Rsync job and emailing me the list. How can I add a subject line.
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | ssmtp my_email@domain.com
I tried this with -s "Subject" but no luck. It only works if I put the subject in a text file and call this text file
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | my_email@domain.com < /path/to/file/subjectline.txt
But than it won't add the search results in the Message.
Any thoughts on what I am doing wrong,
Bas
shell find cron ssmtp
I got a script running (as cronjob) that will list the files in a folder before doing a Rsync job and emailing me the list. How can I add a subject line.
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | ssmtp my_email@domain.com
I tried this with -s "Subject" but no luck. It only works if I put the subject in a text file and call this text file
find /path/to/folder/ -type f -size +1M -name "*.mov" -printf "%fn" | my_email@domain.com < /path/to/file/subjectline.txt
But than it won't add the search results in the Message.
Any thoughts on what I am doing wrong,
Bas
shell find cron ssmtp
shell find cron ssmtp
edited Nov 20 '15 at 8:48
RobertL
4,768624
4,768624
asked Nov 20 '15 at 7:02
Bas
612
612
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
3
down vote
Try this:
echo To: my_email@domain.com
echo From: from_email@example.com
echo Subject: mov files greater than 1M
echo
find /path/to/folder/ -type f -size +1M -name "*.mov"
| ssmtp my_email@domain.com
You don't need the printf
on find
.
Awesome that works really well. The only reason I had the -printf "%fn" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
â Bas
Nov 20 '15 at 11:21
add a comment |Â
up vote
0
down vote
Thanks, works
# cat /opt/mail.sh
#!/bin/bash
echo "Subject: from pc" > /root/myip.txt
curl -s checkip.dyndns.org >> /root/myip.txt
sleep 10
/usr/sbin/ssmtp email@domain.org < /root/myip.txt
# cat /root/myip.txt
Subject: from pc
<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>
New contributor
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
Try this:
echo To: my_email@domain.com
echo From: from_email@example.com
echo Subject: mov files greater than 1M
echo
find /path/to/folder/ -type f -size +1M -name "*.mov"
| ssmtp my_email@domain.com
You don't need the printf
on find
.
Awesome that works really well. The only reason I had the -printf "%fn" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
â Bas
Nov 20 '15 at 11:21
add a comment |Â
up vote
3
down vote
Try this:
echo To: my_email@domain.com
echo From: from_email@example.com
echo Subject: mov files greater than 1M
echo
find /path/to/folder/ -type f -size +1M -name "*.mov"
| ssmtp my_email@domain.com
You don't need the printf
on find
.
Awesome that works really well. The only reason I had the -printf "%fn" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
â Bas
Nov 20 '15 at 11:21
add a comment |Â
up vote
3
down vote
up vote
3
down vote
Try this:
echo To: my_email@domain.com
echo From: from_email@example.com
echo Subject: mov files greater than 1M
echo
find /path/to/folder/ -type f -size +1M -name "*.mov"
| ssmtp my_email@domain.com
You don't need the printf
on find
.
Try this:
echo To: my_email@domain.com
echo From: from_email@example.com
echo Subject: mov files greater than 1M
echo
find /path/to/folder/ -type f -size +1M -name "*.mov"
| ssmtp my_email@domain.com
You don't need the printf
on find
.
answered Nov 20 '15 at 7:18
RobertL
4,768624
4,768624
Awesome that works really well. The only reason I had the -printf "%fn" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
â Bas
Nov 20 '15 at 11:21
add a comment |Â
Awesome that works really well. The only reason I had the -printf "%fn" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
â Bas
Nov 20 '15 at 11:21
Awesome that works really well. The only reason I had the -printf "%fn" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
â Bas
Nov 20 '15 at 11:21
Awesome that works really well. The only reason I had the -printf "%fn" was to trim of the full path and just have the filenames. Thank you very much that was really helpful.
â Bas
Nov 20 '15 at 11:21
add a comment |Â
up vote
0
down vote
Thanks, works
# cat /opt/mail.sh
#!/bin/bash
echo "Subject: from pc" > /root/myip.txt
curl -s checkip.dyndns.org >> /root/myip.txt
sleep 10
/usr/sbin/ssmtp email@domain.org < /root/myip.txt
# cat /root/myip.txt
Subject: from pc
<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>
New contributor
add a comment |Â
up vote
0
down vote
Thanks, works
# cat /opt/mail.sh
#!/bin/bash
echo "Subject: from pc" > /root/myip.txt
curl -s checkip.dyndns.org >> /root/myip.txt
sleep 10
/usr/sbin/ssmtp email@domain.org < /root/myip.txt
# cat /root/myip.txt
Subject: from pc
<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>
New contributor
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Thanks, works
# cat /opt/mail.sh
#!/bin/bash
echo "Subject: from pc" > /root/myip.txt
curl -s checkip.dyndns.org >> /root/myip.txt
sleep 10
/usr/sbin/ssmtp email@domain.org < /root/myip.txt
# cat /root/myip.txt
Subject: from pc
<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>
New contributor
Thanks, works
# cat /opt/mail.sh
#!/bin/bash
echo "Subject: from pc" > /root/myip.txt
curl -s checkip.dyndns.org >> /root/myip.txt
sleep 10
/usr/sbin/ssmtp email@domain.org < /root/myip.txt
# cat /root/myip.txt
Subject: from pc
<html><head><title>Current IP Check</title></head><body>Current IP Address: xxx.xxx.xxx.xxx</body></html>
New contributor
New contributor
answered 6 mins ago
Igors Jakimenko
1
1
New contributor
New contributor
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f244294%2fhow-to-add-subject-line-when-sending-email-output-of-find-using-ssmtp%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password