Anyway, I was searching how to send something with this today even though I've looked at this before, it somehow got screwed up.
We only have mail on our server (and sendmail, but that seems way more complicated) and we need to send an attachment and have a sender address.
After looking around for a while I found this:
uuencode $writefile $readfile |\
mail -s "$subject" $recipient -- -r "$sender"
sorry if you don't like the use of variables in explanations, but this seemed easiest.
| $writefile | is the filename as the person recieving the email will see it (can be same as $readfile) |
| $readfile | is the filename as it is stored on your hard drive |
| $subject | is of course the subject of the mail you are sending |
| $recipient | is the email address of the person you're sending it to | $sender | is the email address that others will see in the From: field in their mail |
uuencode should encode the file so that it will show as an attachment instead of just binary giberish or plain text, but for me, in thunderbird, this doesn't work.
the '|' of course means that you're using the left command as input for the right one
and mail is the mail command.

0 comments:
Post a Comment