use ssh to check and read mail on host?
Hi, all. I'm trying to check and read email on the host using ssh, fetchmail and Alpine. Here's the line I'm using:
ssh user@host gmm
where "gmm" is a script on the host that looks like this:
#!/bin/bash
trap 'exit $USER_INTERRUPT' TERM INT
fetchmail -v --sslproto '' someplace.net
case $? in
1) sleep 4; exit 0;;
0) clamscan /var/spool/mail/user;
case $? in
1) echo "Virus found in mail"; exit 0;;
0) alpine -i;;
esac
esac
Everything works fine on the host. I can shell into host and run the "gmm" script and it fetches my email and opens alpine to the inbox. But if I don't log on to host and just run "ssh user@host gmm" and there is new mail it downloads it but won't open alpine. This is the error I get:
Can't access terminal or input is not a terminal. Redirection of
standard input is not allowed. For example "pine < file" doesn't work.
Does this have to do with ssh or the way I have the line written or both? I understand some of the error has to do with alpine opening the mail file and I could just copy it to the client, but I don't want to have to copy the mail file to the client machine every time because having the same email account content on two machines can be confusing.
Thanks.
|